Install CUDA on Debian

Configuration

  • Debian GNU/Linux 9 (stretch) 64-bit
  • NVIDIA GeForce GT 740M

Purpose

I’m tring to install tensorflow with gpu support.

Attempt 1 (runfile for Ubuntu 16.04)

runfile: https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda_8.0.44_linux-run

$ sudo ./cuda_8.0.44_linux.run --override

Error log (/tmp/cuda_install_6104.log)

Using more to view the EULA.

Installing the CUDA Toolkit in /usr/local/cuda-8.0 ...
Verifying archive integrity... All good.

Uncompressing NVIDIA CUDA..........................................................................................(...)

Can't locate InstallUtils.pm in @INC (you may need to install the InstallUtils module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./install-linux.pl line 6.

BEGIN failed--compilation aborted at ./install-linux.pl line 6.

Verifying archive integrity... All good.

Uncompressing NVIDIA CUDA Samples.........................................................................................(...)

Can't locate InstallUtils.pm in @INC (you may need to install the InstallUtils module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./install-sdk-linux.pl line 6.

BEGIN failed--compilation aborted at ./install-sdk-linux.pl line 6.

'uninstall_cuda_8.0.pl' -> '/usr/local/cuda-8.0/bin/uninstall_cuda_8.0.pl'



Warning: cannot find Toolkit in /usr/local/cuda-8.0. Use --toolkitpath to specify the toolkit location.
Installing the CUDA Samples in /home/riless ...

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installation Failed
Samples:  Installation Failed


Logfile is /tmp/cuda_install_6104.log

Attempt 2 (apt-get)

$ sudo apt install nvidia-cuda-toolkit
$ ln -sf /usr/lib/nvidia-cuda-toolkit /usr/local/cuda 
$ cd tensorflow
$ sudo ./configure 
...
Please specify the location where CUDA  toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: 
Invalid path to CUDA  toolkit. /usr/local/cuda/lib64/libcudart.so cannot be found

What I’ve tried:

$ sudo find / -name "libcudart.so"
/usr/lib/x86_64-linux-gnu/libcudart.so

$ ln -sf /usr/lib/x86_64-linux-gnu/libcudart.so /usr/local/cuda/lib64/libcudart.so

# retried to run configure
$ sudo ./configure
...
ERROR: package contains errors: tensorflow/compiler/tests.
ERROR: error loading package 'tensorflow/compiler/tests': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):
	File "/home/<user>/Downloads/tensorflow/third_party/gpus/cuda_configure.bzl", line 824
		_create_cuda_repository(repository_ctx)
	File "/home/<user>/Downloads/tensorflow/third_party/gpus/cuda_configure.bzl", line 747, in _create_cuda_repository
		_symlink_dir(repository_ctx, cuda_toolkit_path ...", ...")
	File "/home/<user>/Downloads/tensorflow/third_party/gpus/cuda_configure.bzl", line 729, in _symlink_dir
		repository_ctx.path(src_dir).readdir()
/usr/lib/nvidia-cuda-toolkit/nvvm (No such file or directory).

did you try installing:

you may need to install the InstallUtils module

you might also want to try Ubuntu 16.04, since debian is not an officially supported distro

also try this:

https://devtalk.nvidia.com/default/topic/968656/cuda-8-0-on-debian/

I am trying to install tensorflow with GPU support on my new HP Omen (with Nivida 1070m) running Debian sid. However, I have not managed.

  • nvidia driver works fine (390.87)
  • Debian sid comes with CUDA 9.1

I have tried compiling TF (master from git) from source and get errors. Before I waste more time, has anyone solved this? I don’t want to install Ubuntu just for TF-GPU.