Installing Tensorflow and CUDA 10 on Debian Buster the easy way
Installing Tensorflow and CUDA 10 on Debian Buster the easy way
There is plenty of conflicting advice on installing GPU accceleration (CUDA) on Debian machines. If you haven't yet purchased a GPU, I'd recommend getting an AMD GPU and installing ROCm. It just works, and the driver is built into the linux kernel!
If however you have an old Nvidia GPU (I have a 1070Ti) there is a pretty easy approach is outlined here...
This link needs to be updated to use the latest tensorflow which depends on CUDA 10.
Step 1. Install Nvidia Drivers
This requires a specific version of the nvidia driver (418.56 at the time of writing). This is available in the stretch-backports repository. So first add a line for stretch-backports to /etc/apt/sources.list
Then clean out any other version of the driver (really you want to uninstall all possible nvidia software.
aptitude purge nvidia-driver nvidia-dkms nvidia-alternative nvidia-legacy-check nvidia-opencl-common libcuda1 nvidia-smi nvidia-vdpau-driver nvidia-settings nvidia-vulkan-icd
We need to install the older version of the nvidia-driver from backports.
Then clean out any other version of the driver (really you want to uninstall all possible nvidia software.
aptitude purge nvidia-driver nvidia-dkms nvidia-alternative nvidia-legacy-check nvidia-opencl-common libcuda1 nvidia-smi nvidia-vdpau-driver nvidia-settings nvidia-vulkan-icd
We need to install the older version of the nvidia-driver from backports.
sudo apt -t stretch-backports install nvidia-driver
If this results in warnings, then you have some existing nvidia stuff installed. Use aptitude to search for it and purge any packages.
If this results in warnings, then you have some existing nvidia stuff installed. Use aptitude to search for it and purge any packages.
Step 2. Install CUDA 10.0
Download from the deb (local) installer for CUDA 10.0 from the Nvidia Site. You will also need to create a login to download cuDNN.
- dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
- sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64/7fa2af80.pub
- apt update
- apt install cuda-libraries-10-0
- apt install -t stretch-backports libcuda1
- dpkg -i libcudnn7_7.6.0.64-1+cuda10.0_amd64.deb
Step 3. Install Tensorflow
- sudo pip3 install --upgrade tensorflow-gpu
- sudo pip3 install --upgrade keras
python3 -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
stretch-backports on buster? is that right. I get the following error
ReplyDeleteE: The value 'stretch-backports' is invalid for APT::Default-Release as such a release is not available in the sources
any help would be appreciated.
thank you