I have a c++ code that is compiled with cuda 10.1, but I want to install tensorflow-gpu which the latest version of the cuda that it supports is 10.0. I have an Ubunutu 18.04. Each time I want to make tensorflow-qpu work I end up 10 times installing an uninstalling different cuda,cuDnn version. I use pip for installing tensorflow-gpu and .run files for cuda drivers.

How do I install cuda 10.0 so that it would not affect cuda 10.1 installation, and I can just switch each time I want to use the driver?

  • 1
    Look at the ways to select the installation location, and pick a local directory for each. Then just adjust your PATH and LD_LIBRARY_PATH to select the one you want. Works for CUDA 8.0., not sure about 10/10.1
    – ubfan1
    Aug 30, 2019 at 16:03

2 Answers 2


I had installed CUDA 10.1 and CUDNN 7.6 by mistake.

You can use the following configuration (this worked for me as of 9/10):

Tensorflow-gpu == 1.14.0
CUDA 10.1
Ubuntu 18.04

But I had to create symlinks for it to work, as TensorFlow originally works with CUDA 10.

sudo ln -s /opt/cuda/targets/x86_64-linux/lib/libcublas.so /opt/cuda/targets/x86_64-linux/lib/libcublas.so.10.0
sudo cp /usr/lib/x86_64-linux-gnu/libcublas.so.10 /usr/local/cuda-10.1/lib64/
sudo ln -s /usr/local/cuda-10.1/lib64/libcublas.so.10 /usr/local/cuda-10.1/lib64/libcublas.so.10.0
sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/libcusolver.so.10 /usr/local/cuda/lib64/libcusolver.so.10.0
sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/libcurand.so.10 /usr/local/cuda/lib64/libcurand.so.10.0
sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/libcufft.so.10 /usr/local/cuda/lib64/libcufft.so.10.0
sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/libcudart.so /usr/local/cuda/lib64/libcudart.so.10.0
sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/libcusparse.so.10 /usr/local/cuda/lib64/libcusparse.so.10.0

And add the following to my ~/.bashrc:

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-10.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/targets/x86_64-linux/lib/

A way that finally worked for me was that first installed Cuda 10.0 then installed Cuda 10.1 without overwriting /usr/local/cuda library Then you can set Cuda 10.0 as your default driver and if you needed to run that is compiled with Cuda 10.1 you can export path to that version.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .