Install pytorch with CUDA 11


I am trying to install pytorch via anaconda in Ubuntu 20.04 with CUDA 11.

However, I didn’t find the installation option for CUDA 11 on the “Get started” webpage.

Does that mean I have to go back to CUDA 10.2?



I am also facing the same dilemma. Let me know, if, you figured out a workaround solution.

1 Like

me too.
If not yet available, when planning to support CUDA 11?

The binaries are not built yet and you would have to install PyTorch from source at the moment.

CC @Santhosh_Kumar1, @bear_sun


I successfully build PyTorch from source with CUDA 11. However, I still got:

➜  pytorch python
Python 3.8.2 (default, Jul 16 2020, 14:00:26) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda
<module 'torch.cuda' from '/home/jiapei/.local/lib/python3.8/site-packages/torch/cuda/'>
>>> torch.cuda.is_available()
>>> print(torch.version.cuda)
>>> torch.backends.cudnn.enabled

Clearly, the output of torch.cuda.is_available() returned False, which is incorrect.

Any further suggestions?

Your driver might be too old, as CUDA11 needs >= 450.36.06.

1 Like


⋊> ~ nvidia-smi                                                                                                                                                                                       09:56:01
Wed Aug 19 09:56:04 2020       
| NVIDIA-SMI 450.57       Driver Version: 450.57       CUDA Version: 11.0     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|   0  GeForce GTX 105...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   37C    P8    N/A /  N/A |   1439MiB /  4042MiB |     17%      Default |
|                               |                      |                  N/A |

Could you post the install log, so that we can have a look, if CUDA was successfully detected?

Hi, @ptrblck

In fact, even now, I’m NOT sure how to install PyTorch correctly. For me, I’ve got to build twice, one using cmake, the other python build etc.

Under ./build/CMakeFiles, there are 2 .log files:

Any suggestions?

Unfortunately, I cannot access the files. The install log would be still helpful.
The build instructions can be found here.

I tried running this command conda install pytorch==1.6.0 cudatoolkit=11.0 -c pytorch with python v3.7.10, Nvidia-driver 450.119.03 and CUDA version 11.0.

But the problem is torch.cuda.is_available() is returning False and torch.cuda.version is returning None.

It showed me the following logs:

added / updated specs:                                                                                                                                      
    - cudatoolkit=11.0                                                                                                                                        
    - pytorch==1.6.0                                                                                                                                          
The following packages will be downloaded:                                                                                                                    
    package                    |            build                                                                                                             
    cudatoolkit-11.0.3         |       h15472ef_8       951.9 MB  conda-forge                                                                                 
                                           Total:       951.9 MB                                                                                              
The following NEW packages will be INSTALLED:                                                                                                                 
  cffi               conda-forge/linux-64::cffi-1.14.5-py37hc58025e_0                                                                                         
  cudatoolkit        conda-forge/linux-64::cudatoolkit-11.0.3-h15472ef_8
  future             conda-forge/linux-64::future-0.18.2-py37h89c1867_3
  libblas            conda-forge/linux-64::libblas-3.9.0-8_mkl
  libcblas           conda-forge/linux-64::libcblas-3.9.0-8_mkl
  liblapack          conda-forge/linux-64::liblapack-3.9.0-8_mkl
  llvm-openmp        conda-forge/linux-64::llvm-openmp-11.1.0-h4bd325d_1
  mkl                conda-forge/linux-64::mkl-2020.4-h726a3e6_304
  ninja              conda-forge/linux-64::ninja-1.10.2-h4bd325d_0
  numpy              conda-forge/linux-64::numpy-1.21.0-py37h038b26d_0
  pycparser          conda-forge/noarch::pycparser-2.20-pyh9f0ad1d_2
  pytorch            conda-forge/linux-64::pytorch-1.6.0-cpu_py37hf1c21f6_1
  typing_extensions  conda-forge/noarch::typing_extensions-

The following packages will be DOWNGRADED:

  _openmp_mutex                                   4.5-1_gnu --> 4.5-1_llvm

Proceed ([y]/n)? y

Any suggestions?

1 Like

You are installing the CPU version as shown in the logs, since 1.6.0 didn’t ship with cudatoolkit=11.0.


Yeah, I had to install pytorch 1.7.0 which worked fine.

Command I used:

conda install pytorch==1.7.0 cudatoolkit=11.0 -c pytorch

I meet the same problem ,just using mmdetection, the terminal shows : The detected CUDA version (11.0) mismatches the version that was used to compile
PyTorch (10.2). Please make sure to use the same CUDA versions.

To build custom CUDA extensions your local CUDA toolkit will be used and should match the used CUDA runtime shipped in the pip wheels / conda binaries. Install the CUDA11 wheels and it should work.

Thank you! I just want to learn the relation of the cuda,pytorch,cudann,cudatoolkit,where can I see that?

You can print the different versions using print( and would see the used CUDA runtime, cuDNN etc.