wine_lover
(Wine Lover)
February 23, 2023, 2:43am
1
Hello, I was installing pytorch GPU version on linux, and used the following command given on Pytorch site
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
I also have installed cuda tool using
conda install -c “nvidia/label/cuda-11.7.0” cuda-toolkit
Using conda list, the following packages are installed
pytorch 1.4.0 py3.8_cuda10.1.243_cudnn7.6.3_0 pytorch
pytorch-cuda 11.7 h67b0de4_1 pytorch
However, the test result of whether CUDA is available still failed
(torch_test1) bash-4.2$ python
Python 3.8.16 (default, Jan 17 2023, 23:13:24)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.
import torch
torch.cuda.is_available()
False
Any suggestions or advice will be highly appreciated!
ptrblck
February 23, 2023, 4:02am
2
You might be mixing the current release with this older one:
pytorch 1.4.0 py3.8_cuda10.1.243_cudnn7.6.3_0 pytorch
so make sure to install a single binary in your current environment only.
wine_lover:
orch.cuda.is_available()
Hi @ptrblck , I tried to re-install the virtual environment,
1)
conda install -c “nvidia/label/cuda-11.6.0” cuda-toolkit
The nvcc --version verifies that
bash-4.2$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Fri_Dec_17_18:16:03_PST_2021
Cuda compilation tools, release 11.6, V11.6.55
Build cuda_11.6.r11.6/compiler.30794723_0
Then I followed the command line given by pytorch website
conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia
But
torch.cuda.is_available()
still outputs
False
I am not sure which step is wrong, and what do you mean install a single binary Thank you for the the help!
I also tried conda install -c conda-forge pytorch-gpu , and torch.cuda.is_available() still outputs False as well.
Assuming your conda list
outputs the desired PyTorch version showing the corresponding CUDA 11.6 runtime, you should see the CUDA version via print(torch.version.cuda)
. Is this the case?
Hi @ptrblck , when I use conda install -c conda-forge pytorch-gpu to install, the output of print(torch.version.cuda) is 11.2. The conda list result is
python 3.10.9 he550d4f_0_cpython conda-forge
python_abi 3.10 3_cp310 conda-forge
pytorch 1.11.0 cuda112py310h51fe464_1 conda-forge
pytorch-gpu 1.11.0 cuda112py310h68407e5_1 conda-forge
cudatoolkit 11.8.0 h37601d7_11 conda-forge
cudnn 8.4.1.50 hed8a83a_0 conda-forge
Hi @ptrblck , comparing to the above installation approach, as I mentioned, I also tried conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia ,
For this one, the output of print(torch.version.cuda) is None , the conda list result is
python 3.10.9 h7a1cb2a_2
pytorch 2.0.0 py3.10_cpu_0 pytorch
pytorch-cuda 11.6 h867d48c_1 pytorch
pytorch-mutex 1.0 cpu pytorch
cuda 11.6.0 0 nvidia
cuda-cccl 11.6.55 hf6102b2_0 nvidia/label/cuda-11.6.0
cuda-command-line-tools 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-compiler 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-cudart 11.6.55 he381448_0 nvidia/label/cuda-11.6.0
cuda-cudart-dev 11.6.55 h42ad0f4_0 nvidia/label/cuda-11.6.0
cuda-cuobjdump 11.6.55 h9dd2d0c_0 nvidia/label/cuda-11.6.0
cuda-cupti 11.6.55 h43c5c43_0 nvidia/label/cuda-11.6.0
cuda-cuxxfilt 11.6.55 h69de05d_0 nvidia/label/cuda-11.6.0
cuda-driver-dev 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-gdb 11.6.55 hff0b7d4_0 nvidia/label/cuda-11.6.0
cuda-libraries 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-libraries-dev 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-memcheck 11.6.55 h0288dce_0 nvidia/label/cuda-11.6.0
cuda-nsight 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-nsight-compute 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-nvcc 11.6.55 h5758ece_0 nvidia/label/cuda-11.6.0
cuda-nvdisasm 11.6.55 h5556c0d_0 nvidia/label/cuda-11.6.0
cuda-nvml-dev 11.6.55 haa9ef22_0 nvidia/label/cuda-11.6.0
cuda-nvprof 11.6.55 h30b2dac_0 nvidia/label/cuda-11.6.0
cuda-nvprune 11.6.55 h3791f62_0 nvidia/label/cuda-11.6.0
cuda-nvrtc 11.6.55 hc54fff9_0 nvidia/label/cuda-11.6.0
cuda-nvrtc-dev 11.6.55 h42ad0f4_0 nvidia/label/cuda-11.6.0
cuda-nvtx 11.6.55 h99d0529_0 nvidia/label/cuda-11.6.0
cuda-nvvp 11.6.58 h67ee751_0 nvidia/label/cuda-11.6.0
cuda-runtime 11.6.0 0 nvidia
cuda-samples 11.6.101 h8efea70_0 nvidia/label/cuda-11.6.0
cuda-sanitizer-api 11.6.55 h4716e2e_0 nvidia/label/cuda-11.6.0
cuda-toolkit 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-tools 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-visual-tools 11.6.0 0 nvidia/label/cuda-11.6.0
cudatoolkit 11.3.1 h2bc3f7f_2 anaconda
cudnn 8.2.1 cuda11.3_0 anaconda
I don’t know who is building this conda-forge
binary, but it’s not supported by us.
Based on your output you are still installing the CPU-only binary:
pytorch 2.0.0 py3.10_cpu_0 pytorch
I would recommend to uninstall all PyTorch installs in your base environment by executing
conda uninstall pytorch torchvision -y
pip uninstall torch torchvision -y
a few times, then create a new and empty virtual environment, and install the pip wheels or conda binaries using the install command from our website.
Hi @ptrblck , thank you for the suggestions, I just created a new library from scratch. I performed two experiments:
just installing the pip wheels using the command from your website
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
The torch.version.cuda still outputs None . I checked the result of conda list , it does not cuda and cudnn library. I am not sure whether it is the cause, so I performed the second experiment
I first install cuda and cudnn using conda in a fresh new environment
conda install -c anaconda cudnn
conda install -c “nvidia/label/cuda-11.6.0” cuda-toolkit
Then I installed pytorch using pip again
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
However, the torch.version.cuda still outputs None . Here is the conda list result for this environment
torch 2.0.0 pypi_0 pypi
torchaudio 2.0.1 pypi_0 pypi
torchvision 0.15.1 pypi_0 pypi
cuda-cccl 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-command-line-tools 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-compiler 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-cudart 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-cudart-dev 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-cuobjdump 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-cupti 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-cuxxfilt 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-libraries 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-libraries-dev 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-memcheck 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-nsight-compute 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-nvcc 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-nvdisasm 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-nvml-dev 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-nvprof 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-nvprune 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-nvrtc 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-nvrtc-dev 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-nvtx 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-nvvp 11.6.58 0 nvidia/label/cuda-11.6.0
cuda-sanitizer-api 11.6.55 0 nvidia/label/cuda-11.6.0
cuda-toolkit 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-tools 11.6.0 0 nvidia/label/cuda-11.6.0
cuda-visual-tools 11.6.0 0 nvidia/label/cuda-11.6.0
cudatoolkit 11.3.1 h59b6b97_2 anaconda
cudnn 8.2.1 cuda11.3_0 anaconda
wine_lover
(Wine Lover)
March 15, 2023, 10:04pm
10
Hi @ptrblck , just want to give you some update, it seems to me that the pytorch office site happens to have some update today. I just re-install the pytorch, and found that they already update the stable version from 13.1 to 2.0, and it seems that the updated pip installation also works,
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
Here is my current test result
import torch
print(torch.version.cuda)
11.7
print(torch.cuda.is_available())
True
Thanks for the update and it’s good to hear the binaries work now!
There seems to be still some issue in your environment, since you have specified cu116
in the --extra-index-url
while the 11.7 runtime is installed, but at least it seems to be working now for you.