2

I am getting an error while trying to install sklearn:

Reading package lists... Done  
Building dependency tree  
Reading state information... Done

You might want to run 'apt --fix-broken install' to correct these.

The following packages have unmet dependencies:

 cuda-drivers : Depends: nvidia-418 (>= 418.40.04) but it is not going to be installed

 libcuda1-418 : Depends: nvidia-418 (>= 418.40.04) but it is not going to be installed

 nvidia-418-dev : Depends: nvidia-418 (>= 418.40.04) but it is not going to be installed

 nvidia-opencl-icd-418 : Depends: nvidia-418 (>= 418.40.04) but it is not going to be installed

 python-sklearn : Depends: python-numpy but it is not going to be installed
                  Depends: python-scipy but it is not going to be installed
                  Depends: python-sklearn-lib (>= 0.19.1-3) but it is not going to be installed

                  Depends: python-joblib (>= 0.9.2) but it is not going to be installed

                  Recommends: python-nose but it is not going to be installed
                  Recommends: python-pytest but it is not going to be installed
                  Recommends: python-matplotlib but it is not going to be installed

E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

I tried sudo apt --fix-broken install but I get:

Unpacking nvidia-418 (418.40.04-0ubuntu1) ...

dpkg: error processing archive /var/cache/apt/archives/nvidia-418_418.40.04-0ubuntu1_amd64.deb (--unpack):

 trying to overwrite '/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0', which is also in package libglx-mesa0:amd64 18.2.2-0ubu ntu1~18.04.2

Errors were encountered while processing:

 /var/cache/apt/archives/nvidia-418_418.40.04-0ubuntu1_amd64.deb

E: Sub-process /usr/bin/dpkg returned an error code (1)

Also tried purging either nvidia-418 or the packages dependent on it using sudo apt-get remove --purge getdeb-repository to no avail. How do I deal with this?

Liso
  • 15,377
  • 3
  • 51
  • 80
havakok
  • 123

1 Answers1

1

It seems the apt prevent you from --fixing because you had package that being used by two different package, hence the 'trying to overwrite' message. This answer by @AvinashRaj explain what trigger the error.

From the above error report it was clearly shown that, while running sudo apt-get install -f command dpkg tries to extract and install .deb file 1. Installation requires to place package_file_A on the /usr/bin directory.

But it was shocked on seeing the same package_file_A file on the /usr/bin directory and produced the error, because this file was placed to /usr/bin during the installation of some_package.

I changed several word, all credits goes to https://askubuntu.com/a/430443/253251

What to do ?

For a dirty hack you can try to force overwrite the offending files, be careful though.

sudo dpkg -i --force-overwrite /var/cache/apt/archives/nvidia-418_418.40.04-0ubuntu1_amd64.deb

You can then attempt to fix remaining problem.

sudo apt -f install
Liso
  • 15,377
  • 3
  • 51
  • 80