I use blender for my job and I upgraded my Ubuntu to 18.04. After upgrading, I installed CUDA toolkit, but now I get error about dependencies and I want to remove all I installed. How can I do it?

mehman@HP:/opt$ sudo apt autoremove 
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:  libcuinj64-9.1 : Depends: libcuda1 (>= 387.26) but it is not installable or
                           libcuda-9.1-1 E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

mehman@HP:~$ sudo apt --fix-broken 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:
  g++-6 libaccinj64-9.1 libcublas9.1 libcufft9.1 libcufftw9.1 libcuinj64-9.1
  libcurand9.1 libcusolver9.1 libcusparse9.1 libdrm-dev libgl1-mesa-dev
  libglvnd-core-dev libglvnd-dev libnppc9.1 libnppial9.1 libnppicc9.1
  libnppicom9.1 libnppidei9.1 libnppif9.1 libnppig9.1 libnppim9.1 libnppist9.1
  libnppisu9.1 libnppitc9.1 libnpps9.1 libnvblas9.1 libnvgraph9.1 libnvrtc9.1
  libnvtoolsext1 libnvvm3 libopengl0 libpthread-stubs0-dev libstdc++-6-dev
  libthrust-dev libvdpau-dev libx11-dev libx11-doc libx11-xcb-dev libxau-dev
  libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev
  libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev
  libxcb-xfixes0-dev libxcb1-dev libxdamage-dev libxdmcp-dev libxext-dev
  libxfixes-dev libxshmfence-dev libxxf86vm-dev mesa-common-dev
  ocl-icd-opencl-dev opencl-c-headers x11proto-core-dev x11proto-damage-dev
  x11proto-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev
  x11proto-xext-dev x11proto-xf86vidmode-dev xorg-sgml-doctools xtrans-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
73 not fully installed or removed.
Need to get 0 B/20,6 MB of archives.
After this operation, 85,8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 341821 files and directories currently installed.)
Preparing to unpack .../libnvidia-compute-390_390.48-0ubuntu3_amd64.deb ...
Unpacking libnvidia-compute-390:amd64 (390.48-0ubuntu3) ...
dpkg: error processing archive /var/cache/apt/archives/libnvidia-compute-390_390.48-0ubuntu3_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libnvidia-ml.so', which is also in package nvidia-340 340.106-0ubuntu3
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
  • 1
    Try 'apt --fix-broken install' – M. Becerra May 17 '18 at 13:38

There is a conflict between the driver CUDA wants to use (nvidia-390) and the one you have installed. I had the same problem: "which is also in package nvidia-340..." For me this was solved by first purging the old nvidia driver

sudo dpkg -P nvidia-340

Only then would

sudo apt --fix-broken install

work. You can purge everything via

sudo apt purge nvidia*

sudo apt purge cuda*

You can move on to get the newer nvidia drivers

sudo apt install nvidia-390 nvidia-390-dev

Installing the nvidia-384 drivers should also work, but I'm not sure about that.

| improve this answer | |
  • But in 18.04, there is no nvidia-390-dev, and the driver package is named nvidia-driver-390 – ubfan1 May 26 '18 at 19:47
  • Right, feel free to edit that! – khaverim May 27 '18 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.