1

When I try to install any program, I get this error. This is the latest example.

bash pia-linux-2.6.1-05824.run

I get

The following packages have unmet dependencies:
 libfreecad-python3-0.18 : Depends: libocct-data-exchange-7.3 but it is not going to be installed
                           Depends: libocct-foundation-7.3 but it is not going to be installed
                           Depends: libocct-modeling-algorithms-7.3 but it is not going to be installed
                           Depends: libocct-modeling-data-7.3 but it is not going to be installed
                           Depends: libocct-ocaf-7.3 but it is not going to be installed
                           Depends: libocct-visualization-7.3 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). 

So I tried the recommendation

sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libboost-python1.58.0 libboost-signals1.58.0 libcoin80v5 libfontconfig1-dev libfreetype6-dev
  libgcrypt20:i386 libocct-data-exchange-7.2 libocct-foundation-7.2 libocct-modeling-algorithms-7.2
  libocct-modeling-data-7.2 libocct-ocaf-7.2 libocct-visualization-7.2 libpng12-dev libpyside1.2
  libqt4-designer libqt4-help libqt4-scripttools libqt4-test libqtassistantclient4 libshiboken1.2v5
  libsoqt4-20 libudev1:i386 python-cycler python-matplotlib python-pivy python-pyside.qtcore
  python-pyside.qtgui python-pyside.qtsvg python-pyside.qtuitools python-pyside.qtxml python-qt4
  python-qt4-gl python-tz
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libocct-data-exchange-7.3 libocct-foundation-7.3 libocct-modeling-algorithms-7.3
  libocct-modeling-data-7.3 libocct-ocaf-7.3 libocct-visualization-7.3
The following NEW packages will be installed:
  libocct-data-exchange-7.3 libocct-foundation-7.3 libocct-modeling-algorithms-7.3
  libocct-modeling-data-7.3 libocct-ocaf-7.3 libocct-visualization-7.3
0 upgraded, 6 newly installed, 0 to remove and 379 not upgraded.
10 not fully installed or removed.
Need to get 18.0 MB of archives.
After this operation, 67.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu xenial/main amd64 libocct-foundation-7.3 amd64 7.3.0+dfsg1-5~ubuntu16.04.2 [1,237 kB]
Get:2 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu xenial/main amd64 libocct-modeling-data-7.3 amd64 7.3.0+dfsg1-5~ubuntu16.04.2 [2,563 kB]
Get:3 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu xenial/main amd64 libocct-modeling-algorithms-7.3 amd64 7.3.0+dfsg1-5~ubuntu16.04.2 [7,651 kB]
Get:4 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu xenial/main amd64 libocct-visualization-7.3 amd64 7.3.0+dfsg1-5~ubuntu16.04.2 [1,549 kB]
Get:5 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu xenial/main amd64 libocct-ocaf-7.3 amd64 7.3.0+dfsg1-5~ubuntu16.04.2 [1,173 kB]
Get:6 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu xenial/main amd64 libocct-data-exchange-7.3 amd64 7.3.0+dfsg1-5~ubuntu16.04.2 [3,818 kB]
Fetched 18.0 MB in 13s (1,375 kB/s)                                                                                                              
(Reading database ... 1153886 files and directories currently installed.)
Preparing to unpack .../libocct-foundation-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb ...
Unpacking libocct-foundation-7.3:amd64 (7.3.0+dfsg1-5~ubuntu16.04.2) ...
dpkg: error processing archive /var/cache/apt/archives/libocct-foundation-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libTKMath.so.7', which is also in package libocct-foundation-7.2:amd64 7.2.0-0ppa6~ubuntu16.04.1
Preparing to unpack .../libocct-modeling-data-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb ...
Unpacking libocct-modeling-data-7.3:amd64 (7.3.0+dfsg1-5~ubuntu16.04.2) ...
dpkg: error processing archive /var/cache/apt/archives/libocct-modeling-data-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libTKGeomBase.so.7', which is also in package libocct-modeling-data-7.2:amd64 7.2.0-0ppa6~ubuntu16.04.1
Preparing to unpack .../libocct-modeling-algorithms-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb ...
Unpacking libocct-modeling-algorithms-7.3:amd64 (7.3.0+dfsg1-5~ubuntu16.04.2) ...
dpkg: error processing archive /var/cache/apt/archives/libocct-modeling-algorithms-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libTKMesh.so.7', which is also in package libocct-modeling-algorithms-7.2:amd64 7.2.0-0ppa6~ubuntu16.04.1
Preparing to unpack .../libocct-visualization-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb ...
Unpacking libocct-visualization-7.3:amd64 (7.3.0+dfsg1-5~ubuntu16.04.2) ...
dpkg: error processing archive /var/cache/apt/archives/libocct-visualization-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libTKService.so.7', which is also in package libocct-visualization-7.2:amd64 7.2.0-0ppa6~ubuntu16.04.1
No apport report written because MaxReports is reached already
                                                              Preparing to unpack .../libocct-ocaf-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb ...
Unpacking libocct-ocaf-7.3:amd64 (7.3.0+dfsg1-5~ubuntu16.04.2) ...
dpkg: error processing archive /var/cache/apt/archives/libocct-ocaf-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libTKCDF.so.7', which is also in package libocct-ocaf-7.2:amd64 7.2.0-0ppa6~ubuntu16.04.1
No apport report written because MaxReports is reached already
                                                              Preparing to unpack .../libocct-data-exchange-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb ...
Unpacking libocct-data-exchange-7.3:amd64 (7.3.0+dfsg1-5~ubuntu16.04.2) ...
dpkg: error processing archive /var/cache/apt/archives/libocct-data-exchange-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libTKSTEP209.so.7', which is also in package libocct-data-exchange-7.2:amd64 7.2.0-0ppa6~ubuntu16.04.1
No apport report written because MaxReports is reached already
                                                              Processing triggers for libc-bin (2.23-0ubuntu11) ...
Errors were encountered while processing:
 /var/cache/apt/archives/libocct-foundation-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb
 /var/cache/apt/archives/libocct-modeling-data-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb
 /var/cache/apt/archives/libocct-modeling-algorithms-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb
 /var/cache/apt/archives/libocct-visualization-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb
 /var/cache/apt/archives/libocct-ocaf-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb
 /var/cache/apt/archives/libocct-data-exchange-7.3_7.3.0+dfsg1-5~ubuntu16.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried following the instructions in this post The following packages have unmet dependencies!

  1. https://askubuntu.com/a/563319/611345 install the dependencies
sudo apt-get update
sudo apt-get install libocct-foundation-7.3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libfreecad-python3-0.18 : Depends: libocct-data-exchange-7.3 but it is not going to be installed
                           Depends: libocct-modeling-algorithms-7.3 but it is not going to be installed
                           Depends: libocct-modeling-data-7.3 but it is not going to be installed
                           Depends: libocct-ocaf-7.3 but it is not going to be installed
                           Depends: libocct-visualization-7.3 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
sudo apt-get install -f libocct-foundation-7.3
sudo apt-get install -f libocct-foundation-7.3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libfreecad-python3-0.18 : Depends: libocct-data-exchange-7.3 but it is not going to be installed
                           Depends: libocct-modeling-algorithms-7.3 but it is not going to be installed
                           Depends: libocct-modeling-data-7.3 but it is not going to be installed
                           Depends: libocct-ocaf-7.3 but it is not going to be installed
                           Depends: libocct-visualization-7.3 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

  1. https://askubuntu.com/a/1056378/611345 install aptitude

Does not apply because I'm installing with bash and not sudo apt-get install packagename

Even if it did

sudo apt-get -f install aptitude
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 aptitude : Depends: aptitude-common (= 0.7.4-2ubuntu2) but it is not going to be installed
            Depends: libcwidget3v5 but it is not going to be installed
 libfreecad-python3-0.18 : Depends: libocct-data-exchange-7.3 but it is not installable
                           Depends: libocct-foundation-7.3 but it is not installable
                           Depends: libocct-modeling-algorithms-7.3 but it is not installable
                           Depends: libocct-modeling-data-7.3 but it is not installable
                           Depends: libocct-ocaf-7.3 but it is not installable
                           Depends: libocct-visualization-7.3 but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

  1. https://askubuntu.com/a/794360/611345 purge the original program
apt list --installed

returns some relevant packages

freecad/
freecad-common/
freecad-python3/
freecad-runtime/
sudo apt-get --purge remove freecad
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libfreecad-python3-0.18 : Depends: libocct-data-exchange-7.3 but it is not going to be installed
                           Depends: libocct-foundation-7.3 but it is not going to be installed
                           Depends: libocct-modeling-algorithms-7.3 but it is not going to be installed
                           Depends: libocct-modeling-data-7.3 but it is not going to be installed
                           Depends: libocct-ocaf-7.3 but it is not going to be installed
                           Depends: libocct-visualization-7.3 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
  1. https://askubuntu.com/a/563537/611345

not applicable because I don't care about freecad anymore, I'm trying to install something completely unrelated and it happens no matter what I'm trying to install

  1. https://askubuntu.com/a/563291/611345

not applicable because it's specific to postgresql

  1. How do I resolve unmet dependencies after adding a PPA?

I tried removing the freecad ppa and trying to install the program again, same error

  • You have multiple "trying to overwrite" errors. That usually means you are installing similar-named packages from different sources that are incompatible with each other. You must choose which source to use, and purge the other source (and it's packages). Tighten up your admin skills - overwrite errors are due to human admin sloppiness. – user535733 Dec 30 '20 at 20:52
  • What is the Ubuntu version? – David Dec 31 '20 at 14:55

1 Answers1

2

Someone pointed out I had "trying to overwrite" errors, so I did some more research, and following the advice on another answer https://askubuntu.com/a/433510/611345 I solved the problem by purging conflicting packages.

The thing it always complains about is libfreecad-python3-0.18 so I tried purging that first

$ sudo dpkg -P libfreecad-python3-0.18
dpkg: dependency problems prevent removal of libfreecad-python3-0.18:
 freecad-python3 depends on libfreecad-python3-0.18 (<< 2:0.18.4+dfsg1~201911102059~ubuntu16.04.1+1~).
 freecad-python3 depends on libfreecad-python3-0.18 (>= 2:0.18.4+dfsg1~201911102059~ubuntu16.04.1).
 freecad-python3 depends on libfreecad-python3-0.18 (<< 2:0.18.4+dfsg1~201911102059~ubuntu16.04.1+1~).
 freecad-python3 depends on libfreecad-python3-0.18 (>= 2:0.18.4+dfsg1~201911102059~ubuntu16.04.1).

dpkg: error processing package libfreecad-python3-0.18 (--purge): dependency problems - not removing Errors were encountered while processing: libfreecad-python3-0.18

But it said it couldn't do it because freecad-python3 depends on it so I tried removing that next

$ sudo dpkg -P freecad-python3
dpkg: dependency problems prevent removal of freecad-python3:
 freecad depends on freecad-python3 | freecad-python2; however:
  Package freecad-python3 is to be removed.
  Package freecad-python2 is not installed.

dpkg: error processing package freecad-python3 (--purge): dependency problems - not removing Errors were encountered while processing: freecad-python3

But then it said freecad depends on that, so I tried removing that next

$ sudo dpkg -P freecad
(Reading database ... 1153885 files and directories currently installed.)
Removing freecad (2:0.18.4+dfsg1~201911102059~ubuntu16.04.1) ...
Processing triggers for shared-mime-info (1.5-2ubuntu0.2) ...

It worked, so I tried freecad-python3 again

$ sudo dpkg -P freecad-python3
(Reading database ... 1153879 files and directories currently installed.)
Removing freecad-python3 (2:0.18.4+dfsg1~201911102059~ubuntu16.04.1) ...

And then libfreecad-python3-0.18 again

$ sudo dpkg -P libfreecad-python3-0.18
(Reading database ... 1153872 files and directories currently installed.)
Removing libfreecad-python3-0.18 (2:0.18.4+dfsg1~201911102059~ubuntu16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...

After this I could install other programs.