Error: Depends: libcublas-dev (>= 10.1.0.105) but it is not installed, Ubuntu 18.04

Hi,

I am running Ubuntu version 18.04 and have a RTX 2070, and I get an error message after I installed CUDA toolkit version 10.1 that:

cuda-libraries-dev-10-1: Depends: libcublas-dev (>= 10.1.0.105) but it is not installed
cuda-samples-10-1: Depends: libcublas-dev (>= 10.1.0.105) but it is not installed
cuda-visual-tools-10-1: Depends: libcublas-dev (>= 10.1.0.105) but it is not installed

This error pops up for example when an trying to perform the Software Updater in Ubuntu.

After some investigation I found out that the system thought that I was running on version 418, which I have not installed. I tried to run the "

nvidia-smi

" command in terminal, but it failed.

I was trying to reinstall the drivers (version 410) but it recommended me that I should update the drivers (version 418). I noticed that I could install the new driver version 418.39, which I did, then the “nvidia-smi” worked and returned all correct information.

Fri Mar  1 17:32:42 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.43       Driver Version: 418.43       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 2070    On   | 00000000:05:00.0  On |                  N/A |
|  0%   32C    P8    20W / 185W |    528MiB /  7944MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

I still get the error message, and i have tried running the command "

sudo apt --fix-broken install

", but this one gives back:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libcublas-dev
The following NEW packages will be installed:
  libcublas-dev
0 upgraded, 1 newly installed, 0 to remove and 133 not upgraded.
77 not fully installed or removed.
Need to get 0 B/39,9 MB of archives.
After this operation, 115 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 265190 files and directories currently installed.)
Preparing to unpack .../libcublas-dev_10.1.0.105-1_amd64.deb ...
Unpacking libcublas-dev (10.1.0.105-1) ...
dpkg: error processing archive /var/cache/apt/archives/libcublas-dev_10.1.0.105-1_amd64.deb (--unpack):
 trying to overwrite '/usr/include/cublas_v2.h', which is also in package nvidia-cuda-dev 9.1.85-3ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libcublas-dev_10.1.0.105-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Thank for any help!

Try to uninstall all cuda versions before you install 10.1 (I personally would stick to 10.0, 10.1 seems to be broken)

The Nvidia driver and cuda are two different things. You can have the same driver for different versions of cuda or no cuda. I won’t mess with the driver if it is working.

1 Like

I faced the similar issue and the display also zoomed out without a way to get back normal resolution. I tried dpkg error recovery in linux error recovery mode which fixed the display and also libcubals related error. Please give a try.

I have the exact same problem. I tried booting in dpkg error recovery mode but it didn’t do it. Now I am stuck and can’t even uninstall the packages because of unsatisfied dependancies… If someone found the way to fix this please post it !

I have a similar problem after running “sudo apt-get upgrade” today, and I am kind of stuck:

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cuda-8-0 : Depends: cuda-toolkit-8-0 (>= 8.0.61) but it is not going to be installed
            Depends: cuda-runtime-8-0 (>= 8.0.61) but it is not going to be installed
            Depends: cuda-demo-suite-8-0 (>= 8.0.61) but it is not going to be installed
 cuda-libraries-dev-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not going to be installed
 cuda-samples-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not going to be installed
 cuda-visual-tools-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

But Running “sudo apt --fix-broken install” results in:

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:
  cuda-10-0 cuda-command-line-tools-10-0 cuda-compiler-10-0 cuda-cublas-10-0 cuda-cublas-dev-10-0 cuda-cufft-10-0 cuda-cufft-dev-10-0 cuda-cuobjdump-10-0
  cuda-curand-10-0 cuda-curand-dev-10-0 cuda-cusolver-10-0 cuda-cusolver-dev-10-0 cuda-cusparse-10-0 cuda-cusparse-dev-10-0 cuda-demo-suite-10-0 cuda-documentation-10-0
  cuda-gdb-10-0 cuda-gpu-library-advisor-10-0 cuda-libraries-10-0 cuda-libraries-dev-10-0 cuda-memcheck-10-0 cuda-npp-10-0 cuda-npp-dev-10-0 cuda-nsight-10-0
  cuda-nsight-compute-10-0 cuda-nvdisasm-10-0 cuda-nvgraph-10-0 cuda-nvgraph-dev-10-0 cuda-nvjpeg-10-0 cuda-nvjpeg-dev-10-0 cuda-nvml-dev-10-0 cuda-nvprof-10-0
  cuda-nvprune-10-0 cuda-nvrtc-10-0 cuda-nvrtc-dev-10-0 cuda-nvtx-10-0 cuda-nvvp-10-0 cuda-runtime-10-0 cuda-samples-10-0 cuda-toolkit-10-0 cuda-tools-10-0
  cuda-visual-tools-10-0 libnvidia-common-410
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libcublas-dev
The following NEW packages will be installed:
  libcublas-dev
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
67 not fully installed or removed.
Need to get 0 B/39,9 MB of archives.
After this operation, 115 MB of additional disk space will be used.
Do you want to continue? [Y/n]
(Reading database ... 267463 files and directories currently installed.)
Preparing to unpack .../libcublas-dev_10.1.0.105-1_amd64.deb ...
Unpacking libcublas-dev (10.1.0.105-1) ...
dpkg: error processing archive /var/cache/apt/archives/libcublas-dev_10.1.0.105-1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/stubs/libcublas.so', which is also in package nvidia-cuda-dev 9.1.85-3ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libcublas-dev_10.1.0.105-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

now “sudo apt autoremove” gives:

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-libraries-dev-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not installed
 cuda-samples-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not installed
 cuda-visual-tools-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

What should I do?

1 Like

I had the same problem, and I couldn’t use apt to install anything with this problem, purge wouldn’t even work. I was running on a primus card.

  1. I (re)moved the cuda `ppa`
  2. Then selected the intel GPU
  3. Then updated apt for good measure
  4. I could then atleast force purge nvidia, after an error, and Cuda-10-1 was removed
  5. Updated my packages that I hadn't been able to.
  6. Rebooted.
  7. auto removed things
  8. Was back to Cuda 10.0.130.1

I could now actually use apt to upgrade things.
This put me back to the 410.104 drivers after reboot. (which I had at one point chosen through the Ubuntu Software & Updates GUI interface while trying to get things rewound, this might be why I ended up back on these drivers, they might have been queued up already)

I think this may have been the step I did not follow when these 10.1 drivers got installed: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#handle-uninstallation

I don’t have time right now to try to get 10.1 working. Hopefully someone else can. Bash below, GL

Edit: Just found this as a potential solution as well: https://devtalk.nvidia.com/default/topic/1047981/cuda-setup-and-installation/cublas-for-10-1-is-missing/post/5318324/#5318324

sudo prime-select intel
sudo mv /etc/apt/sources.list.d/cuda.list $HOME/cuda.list.bak
sudo apt update
sudo apt-get purge nvidia-*
sudo apt-get -f install
sudo apt update
sudo apt autoremove

Thank you, this helped. “prime-select intel” enabled me to purge nvidia as you proposed. After that I was still not directly able to install cuda again (Error “Unable to locate package cuda-8-0”), but after following whlteXbread’s post it seemed to worked:

https://askubuntu.com/questions/995542/installing-cuda-8-on-ubuntu-16-unable-to-locate-package-cuda

until

sudo apt-get install cuda-8-0
...
Errors were encountered while processing:
 /tmp/apt-dpkg-install-UEuLOw/40-nvidia-418_418.39-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I am not sure what to do now?

I was finally able to fix it with this:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/nvidia-418_418.39-0ubuntu1_amd64.deb
sudo apt --fix-broken install
4 Likes

@frankg7uvc, thank you for that, you saved me alot of time!! my issue was with this package and cublas:

/var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb

sudo dpkg -i --force-overwrite  /var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb
sudo apt --fix-broken install
2 Likes

I found this answer here helpful:

to remove pkgs without interruption ( aggressive way ) because there is no way others doing it
PKG=“something” ## in our case its Nvidia or/and Cuda
for item in dpkg -i grep ${PGK} | awk '{print $2}' ; do dpkg --remove --force-all $item ; done
so mean it’s will remove the pgks without any issues

Related: https://bugs.launchpad.net/ubuntu/+source/nvidia-cuda-toolkit/+bug/1846530

Remove cuda ppa from source and run auto fix seems worked for me.

I had the same issue last night. libcublas-dev was broken. I was gonna uninstall 10.2 and go back to 10.0 but retried this morning. sudo apt install nvidia-cuda-dev and it worked. cudnn_samples_v7 worked.

I seem to have solved this by forcing the apt --fix-broken install to overwrite files with the -o Dpkg::Options::="--force-overwrite" option (see https://raphaelhertzog.com/2011/08/01/understanding-dpkgs-file-overwrite-error/). A number of files are overwritten.

I then removed nvidia-cuda-dev (which I understand is an ubuntu package to support cuda, but only uses CUDA 9 and is not needed for CUDA 10) and ran apt --reinstall install libcublas-dev just to be sure (in case removing nvidia-cuda-dev removed something we need). When I did the --fix-broken above, only that pakcage reported overwriting stuff, so I guess other packages didn’t have file conflicts and should be ok.

fyi: in this way I don’t get nvcc on the path, and no doubt some other things aren’t lined up properly (after all, nvidia-cuda-dev is ubuntu’s official package to access, well, cuda dev files – as of writing, ubuntu is only up to cuda 9.1 though). What I did was sufficient to install torch-geometric however, which was my purpose.

2 Likes

I fixed this issue by running this command:

sudo apt-get -o Dpkg::Options::="–force-overwrite" install --fix-broken

2 Likes

Life saver