title: How to install CUDA 10.1 on linux ubuntu?
body: <p>I'm trying to get tensorflow to work with CUDA 10.1, but every time I try to install any driver (any version) it just keeps installing CUDA 11 (which isn't compatible with tensorflow). I've tried .deb installs of both the driver and CUDA. I also tried installing the latest driver, and then install CUDA 10.1 through the local .run file and telling CUDA <strong>not to install the driver</strong>. This does install cuda 10.1 in my /usr/local folder, but when I try <code>nvidia-smi</code> it always specifies CUDA 11 every time.</p>
  <p>I've done tons of research, and saw that the version mentioned by <code>nvidia-smi</code> specifies the latest supported cuda runtime, but doesn't necessarily reflect the actual installed CUDA library?</p>
  <p>So I supposedly have cuda 10.1 installed (under /usr/local) and try to run a test command on tensorflow:
  <code>tf.config.list_physical_devices('GPU')</code> but this gives an error:</p>
  <pre><code>2020-09-30 17:36:38.765577: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
  2020-09-30 17:36:38.765604: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
  /home/robbe/Desktop/usiigaci-optimized/venv/lib/python3.7/site-packages/pandas/compat/__init__.py:120: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.
    warnings.warn(msg)
  2020-09-30 17:36:40.493592: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
  2020-09-30 17:36:40.522334: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
  2020-09-30 17:36:40.522943: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties: 
  pciBusID: 0000:01:00.0 name: GeForce GTX 1050 Ti computeCapability: 6.1
  coreClock: 1.455GHz coreCount: 6 deviceMemorySize: 3.94GiB deviceMemoryBandwidth: 104.43GiB/s
  2020-09-30 17:36:40.523063: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
  2020-09-30 17:36:40.583631: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
  2020-09-30 17:36:40.583961: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcufft.so.10'; dlerror: libcufft.so.10: cannot open shared object file: No such file or directory
  2020-09-30 17:36:40.584167: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcurand.so.10'; dlerror: libcurand.so.10: cannot open shared object file: No such file or directory
  2020-09-30 17:36:40.584358: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcusolver.so.10'; dlerror: libcusolver.so.10: cannot open shared object file: No such file or directory
  2020-09-30 17:36:40.584543: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcusparse.so.10'; dlerror: libcusparse.so.10: cannot open shared object file: No such file or directory
  2020-09-30 17:36:40.704140: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7
  2020-09-30 17:36:40.704203: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1753] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
  Skipping registering GPU devices...
  </code></pre>
  <p>So obviously it can't find the right cuda 10.1 object libraries although it does exist under /usr/local/cuda-10.1.
  Also <strong>there are executables (including the nvidia-smi which displays cuda 11) under /usr/bin</strong> and I think these ones override the 10.1 directory under /usr/local?</p>
  <p>things I've tried:</p>
  <ul>
  <li>Install NVIDIA driver &amp; install CUDA with driver. When doing this CUDA actually installs NVIDIA driver 418 and gives me an obscure exception about a kernel module that can't be unloaded.</li>
  <li>Install driver manually through grub rescue (because of exception in first step), then install CUDA 10.1 (local .run &amp; don't include nvidia driver). So install nvidia driver and cuda completely seperately.</li>
  <li>Install latest NVIDIA driver through GUI: Software -&gt; additional drivers</li>
  </ul>
  <p>Things that worked:</p>
  <ul>
  <li>Install CUDA with local .run and tell it not to include driver. This installs cuda 10.1 successfully under /usr/local, but isn't recognized by tensorflow <strong>or</strong> <code>nvidia-smi</code> command.</li>
  </ul>
  <p>I'm at my wits' end and I've come to the conclusion that tensorflow and CUDA are just terrible to work with, nonetheless I need it to work, can anyone help?</p>
  <p>Thank you.</p>