Install pytorch 1.9.0 with unexpected problem

I follow the official guide to install pytorch 1.9.0 + cuda11.3

conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cudatoolkit=11.3 -c pytorch -c conda-forge

after installment finished, it seems cpu version is installed,not GPU

(py190) hitbuyi@hitbuyi-Dell-G15-5511:~/tmp/$ conda list
packages in environment at /home/hitbuyi/.conda/envs/py190:
Name Version Build Channel

cpuonly 1.0 0 pytorch
cudatoolkit 11.3.1 h2bc3f7f_2
imagesize 1.4.1 pypi_0 pypi
importlib-metadata 4.12.0 pypi_0 pypi
imutils 0.5.4 pypi_0 pypi
intel-openmp 2022.0.1 h06a4308_3633
joblib 1.1.0 pypi_0 pypi
jpeg 9b h024ee3a_2
kiwisolver 1.4.2 pypi_0 pypi
lame 3.100 h7f98852_1001 conda-forge
ld_impl_linux-64 2.35.1 h7274673_9
libffi 3.3 he6710b0_2
libgcc-ng 9.3.0 h5101ec6_17
libgomp 9.3.0 h5101ec6_17
libiconv 1.16 h516909a_0 conda-forge
libpng 1.6.37 h21135ba_2 conda-forge
libstdcxx-ng 9.3.0 hd4cf53a_17
libtiff 4.1.0 h2733197_1
libuv 1.42.0 h7f98852_0 conda-forge
lz4-c 1.9.3 h9c3ff4c_1 conda-forge
markdown 3.4.1 pypi_0 pypi
markupsafe 2.1.1 pypi_0 pypi
matplotlib 3.5.1 pypi_0 pypi
mkl 2020.2 256
mkl-service 2.3.0 py38h1e0a361_2 conda-forge
mkl_fft 1.2.0 py38hab2c0dc_1 conda-forge
mkl_random 1.2.0 py38hc5bc63f_1 conda-forge
mpmath 1.2.1 pypi_0 pypi
ncurses 6.3 h7f8727e_2
nettle 3.6 he412f7d_0 conda-forge
ninja 1.10.2 h4bd325d_0 conda-forge
numpy 1.22.3 pypi_0 pypi
numpy-base 1.19.2 py38hfa32c7d_0
nvidia-dali-cuda110 1.16.0 pypi_0 pypi
oauthlib 3.2.0 pypi_0 pypi
olefile 0.46 pyh9f0ad1d_1 conda-forge
onnx 1.11.0 pypi_0 pypi
onnx-simplifier 0.3.7 pypi_0 pypi
onnxoptimizer 0.2.6 pypi_0 pypi
onnxruntime 1.11.0 pypi_0 pypi
opencv-contrib-python pypi_0 pypi
opencv-python pypi_0 pypi
openh264 2.1.1 h780b84a_0 conda-forge
openssl 1.1.1q h7f8727e_0
packaging 21.3 pypi_0 pypi
pandas 1.4.1 pypi_0 pypi
pathspec 0.9.0 pypi_0 pypi
pillow 9.0.1 pypi_0 pypi
pip 21.2.4 py38h06a4308_0
python 3.8.12 h12debd9_0
python-dateutil 2.8.2 pypi_0 pypi
python_abi 3.8 2_cp38 conda-forge
pytorch 1.9.0 py3.8_cpu_0 [cpuonly] pytorch
pytz 2022.1 pypi_0 pypi
pyyaml 6.0 pypi_0 pypi
readline 8.1.2 h7f8727e_1
requests 2.27.1 pypi_0 pypi
requests-oauthlib 1.3.1 pypi_0 pypi
rsa 4.9 pypi_0 pypi
scikit-learn 1.1.1 pypi_0 pypi
scipy 1.8.0 pypi_0 pypi
seaborn 0.11.2 pypi_0 pypi
setuptools 58.0.4 py38h06a4308_0
six 1.16.0 pyh6c4a22f_0 conda-forge
sklearn 0.0 pypi_0 pypi
sqlite 3.38.0 hc218d9a_0
sympy 1.10.1 pypi_0 pypi
tensorboard 2.9.1 pypi_0 pypi
tensorboard-data-server 0.6.1 pypi_0 pypi
tensorboard-plugin-wit 1.8.1 pypi_0 pypi
threadpoolctl 3.1.0 pypi_0 pypi
tk 8.6.11 h1ccaba5_0
torchaudio 0.9.0 pypi_0 pypi
torchstat 0.0.7 pypi_0 pypi
torchvision 0.10.0 py38_cpu [cpuonly] pytorch
tqdm 4.64.0 pypi_0 pypi
typing-extensions 4.1.1 pypi_0 pypi
typing_extensions 4.3.0 pyha770c72_0 conda-forge
ujson 5.4.0 pypi_0 pypi
urllib3 1.26.9 pypi_0 pypi
werkzeug 2.2.1 pypi_0 pypi
wheel 0.37.1 pyhd3eb1b0_0
xz 5.2.5 h7b6447c_0
zipp 3.8.1 pypi_0 pypi
zlib 1.2.11 h7f8727e_4
zstd 1.4.9 ha95c52a_0 conda-forge

(py190) hitbuyi@hitbuyi-Dell-G15-5511:~/WorkInDD/Deploy/nVidia/DALI$ python
Python 3.8.12 (default, Oct 12 2021, 13:49:34)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import torch
import torch
Traceback (most recent call last):
File “”, line 1, in
AttributeError: module ‘torch’ has no attribute ‘is_cuda_available’

According to output of conda list
1, what is cpuonly?
2, the following
pytorch 1.9.0 py3.8_cpu_0 [cpuonly] pytorch

means that pytorch 1.9.0 cpu version is installed, not GPU version, why?

any help is appreciated .

Yes, it seems the CPU-only binary was installed. The install log should show which package was found and might give you more information why the binary with the CUDA runtime wasn’t installed.
PS: I would also recommend to install the latest binary (1.12.0) instead of an older one for the latest fixes and features.

I found on site, pytorch 1.9.0 has no stable version connecting to cuda11.3, so pytorch 1.9.0 + cuda11.3 is not good choice, right?

in my local computer, I installed a cuda version of 11.3 in ubutnu environment, when I run offical command
conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cudatoolkit=11.3 -c pytorch -c conda-forge

it detects my local cuda of version v11.3, and is forced to change to cpu version? is this possible ? if so, I think it isn’t to a good strategy, since local cuda is independent to cuda in conda’s virtual environment, more than one versions of cuda exist in my computer.
1 ubuntu: cuda 11.3
2 conda: 1) tensorflow + cuda 10.2 2)pytorch1.9.0 + cuda11.1(I want to change it to pytorch1.9.0 + cuda11.3)

I use pytorch 1.10, which is in list of, and installment of gpu version is successful.

Yes, this could indeed be the case and I don’t remember which PyTorch binary release shipped with the CUDA 11.3 runtime. Note that your local CUDA toolkit won’t be used unless you build PyTorch from source or a custom CUDA extension.
Good to hear it’s working now!