0

I have a new build PC with Ubuntu 18.04.1 and anaconda 4.5.8, and I'm attempting to install tensorflow_gpu. The graphics card is in place on the motherboard but the drivers have not been installed yet.

I was attempting to follow this tutorial to install tensorflow_gpu in Ubuntu 18.04.1.

https://medium.com/@taylordenouden/installing-tensorflow-gpu-on-ubuntu-18-04-89a142325138

The first step is to type:

$ nvidia-smi 

From this I got:

Command 'nvidia-smi' not found, but can be installed with:

sudo apt install nvidia-340      
sudo apt install nvidia-utils-390

So I typed them in thinking this would allow the nvidia-smi would work.

Command 'nvidia-smi' not found, but can be installed with:

$sudo apt install nvidia-340      

This installed OK

But when I ran sudo apt install nvidia-utils-390:

desktop:~$ sudo apt install nvidia-utils-390
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libnvidia-compute-390
Suggested packages:
  nvidia-driver-390
The following packages will be REMOVED
  libcuda1-340 nvidia-opencl-icd-340
The following NEW packages will be installed
  libnvidia-compute-390 nvidia-utils-390
0 to upgrade, 2 to newly install, 2 to remove and 0 not to upgrade.
Need to get 20.9 MB of archives.
After this operation, 30.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://gb.archive.ubuntu.com/ubuntu bionic/restricted amd64 libnvidia-compute-390 amd64 390.48-0ubuntu3 [20.6 MB]
Get:2 http://gb.archive.ubuntu.com/ubuntu bionic/restricted amd64 nvidia-utils-390 amd64 390.48-0ubuntu3 [321 kB]
Fetched 20.9 MB in 7s (2,861 kB/s)                                             
(Reading database ... 138972 files and directories currently installed.)
Removing libcuda1-340 (340.106-0ubuntu3) ...
Removing nvidia-opencl-icd-340 (340.106-0ubuntu3) ...
Selecting previously unselected package libnvidia-compute-390:amd64.
(Reading database ... 138957 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
Selecting previously unselected package nvidia-utils-390.
Preparing to unpack .../nvidia-utils-390_390.48-0ubuntu3_amd64.deb ...
Unpacking nvidia-utils-390 (390.48-0ubuntu3) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-utils-390_390.48-0ubuntu3_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/nvidia-bug-report.sh', which is also in package nvidia-340 340.106-0ubuntu3
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libnvidia-compute-390_390.48-0ubuntu3_amd64.deb
 /var/cache/apt/archives/nvidia-utils-390_390.48-0ubuntu3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Now when I try nvidia-smi I get:

desktop:~$ nvidia-smi
    NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

Q1.) How do I undo/fix this broken install?

Q2.) What should I install so that when I type nvidia-smi it gives me the output as shown in the tutorial so that I can then follow the rest of the tutorial!

Bazman
  • 415
  • 2
    Possible duplicate of dpkg error: "trying to overwrite file, which is also in..." You can't have both nvidia-390 packages (which you need) and nvidia-340 packages (which you don't need and which is causing the problem) installed at the same time. Search in the terminal for all installed nvidia-340 packages, uninstall them all and reboot with sudo reboot. – karel Jul 30 '18 at 13:58
  • 1
    Before you reboot install the suggested package nvidia-driver-390 too. You need the dependencies that are installed with nvidia-driver-390 for TensorFlow. – karel Jul 30 '18 at 14:05
  • apt list --installed gives: nvidia-340/bionic,now 340.106-0ubuntu3 amd64 [installed] nvidia-settings/bionic,now 390.42-0ubuntu1 amd64 [installed,automatic] – Bazman Jul 30 '18 at 14:11
  • Is this the correct way to search in terminal (sorry I am a noob!). – Bazman Jul 30 '18 at 14:12
  • 1
    These are the packages that you should not have installed: nvidia-340 nvidia-340-dev nvidia-340-updates nvidia-340-updates-dev nvidia-340-updates-uvm nvidia-340-uvm. If any of these packages are installed then remove them. – karel Jul 30 '18 at 14:12
  • To remove them should I use sudo apt-get purge nvidia-340 or sudo apt-get remove nvidia-340 – Bazman Jul 30 '18 at 14:13
  • 1
    I recommend using sudo apt-get purge for this command. – karel Jul 30 '18 at 14:14
  • OK nvidia-340 and nvidia-settings purged. There are now no nvidia packages listed when I type apt list --installed. How do I now install the correct version so that I can follow the rest of the medium post? – Bazman Jul 30 '18 at 14:21
  • sudo apt install nvidia-utils-390 now runs producing no errors but sudo apt install nvidia-utils-390 gives: NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running. How can I now install the correct drivers? – Bazman Jul 30 '18 at 14:26
  • 1
    You're right. I have the same configuration as you in 18.04, so I checked and discovered that nvidia-smi is not required by nvidia-driver-390, so please uninstall nvidia-smi with sudo apt remove nvidia-smi and reboot. – karel Jul 30 '18 at 15:03

0 Answers0