1

I am trying to install CUDA in Ubuntu 18.04.3 LTS according to this documentation from nvidia.

I ran into trouble when I tried to install linux headers by the following command.

sudo apt-get install linux-headers-$(uname -r)

It raised an Unmet dependencies error.

The following packages have unmet dependencies:
 libcuinj64-9.1 : Depends: libcuda1 (>= 387.26) or
                           libcuda-9.1-1
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When I tried

sudo apt --fix-broken install

I got

dpkg: error processing archive /var/cache/apt/archives/libnvidia-compute-430_430.26-0ubuntu0.18.04.2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libnvidia-ml.so', which is also in package nvidia-340 340.107-0ubuntu0.18.04.3
Errors were encountered while processing:
 /var/cache/apt/archives/libnvidia-compute-430_430.26-0ubuntu0.18.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

The whole terminal output can be seen here.

This is the gpu I have

  *-display                 
       description: VGA compatible controller
       product: GM204 [GeForce GTX 970]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nouveau latency=0
       resources: irq:29 memory:f6000000-f6ffffff memory:e0000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:c0000-dffff

I am not sure where to go from here. Can anyone help?

Sounak
  • 119
  • 3
    Linux headers installation does not fail, as the output clearly says linux-headers-4.15.0-64-generic is already the newest version (4.15.0-64.73)., which is usually preinstalled. The documentation says to check for linux-headers before installing cuda, which you seem to have followed backwards. Something else must have caused the "unmet dependencies" error, which you'll need to undo. Also, the nouveau driver is up, while it should be blacklisted, and I see no nvidia driver installed. – mikewhatever Oct 07 '19 at 21:44
  • 1
    see https://askubuntu.com/questions/61396/how-do-i-install-the-nvidia-drivers See what Nvidia drivers are offered in the Software and Updates/Additional Drivers. If not current enough, add the graphics-drivers ppa and check again. Consider dropping back a CUDA version or two if the latest takes a driver only available from Intel -- you might get it to work, but with some effort. – ubfan1 Oct 08 '19 at 04:40

1 Answers1

0

I did not have any proprietary nvidia-driver installed. From the ubuntu menu I went to Software and Updates > Additional Drivers and installed nvidia-driver-430.

foo@42:~$ sudo lshw -C display
  *-display                 
       description: VGA compatible controller
       product: GM204 [GeForce GTX 970]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:30 memory:f6000000-f6ffffff memory:e0000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:c0000-dffff

The driver changed from nouveau to nvidia. It also installed CUDA Version: 10.2

foo@42:~$ nvidia-smi
Tue Oct  8 22:27:48 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.26       Driver Version: 430.26       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| 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 GTX 970     Off  | 00000000:01:00.0  On |                  N/A |
|  0%   43C    P8    16W / 200W |    191MiB /  4039MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      4953      G   /usr/lib/xorg/Xorg                            16MiB |
|    0      4998      G   /usr/bin/gnome-shell                          51MiB |
|    0      5151      G   /usr/lib/xorg/Xorg                            79MiB |
|    0      5392      G   ...ervice-request-channel-token=1831114496    39MiB |
Sounak
  • 119