Torch==1.13.+cu117 on Ubuntu 22.04 using pip

I installed CUDA 11.7 but not sure why I get this error or how to fix it? I got the command from official pytorch website for older versions

(oneposeplus) mona@ard-gpu-01:~$ pip install -U torch==1.13.0+cu117 torchtext==0.14.0 --extra-index-url https://download.pytorch.org/whl/cu117
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu117
Collecting torch==1.13.0+cu117
  Downloading https://download.pytorch.org/whl/cu117/torch-1.13.0%2Bcu117-cp311-cp311-linux_x86_64.whl (1807.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 GB 3.4 MB/s eta 0:00:00
ERROR: Could not find a version that satisfies the requirement torchtext==0.14.0 (from versions: 0.1.1, 0.2.0, 0.2.1, 0.2.3, 0.3.1, 0.4.0, 0.5.0, 0.6.0, 0.15.0+cpu, 0.15.1, 0.15.1+cpu, 0.15.2, 0.15.2+cpu)
ERROR: No matching distribution found for torchtext==0.14.0
(oneposeplus) mona@ard-gpu-01:~$ pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu117
Collecting torch==1.13.1+cu117
  Downloading https://download.pytorch.org/whl/cu117/torch-1.13.1%2Bcu117-cp311-cp311-linux_x86_64.whl (1801.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 GB 3.7 MB/s eta 0:00:00
ERROR: Could not find a version that satisfies the requirement torchvision==0.14.1+cu117 (from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3, 0.15.0, 0.15.0+cu117, 0.15.1, 0.15.1+cu117, 0.15.2, 0.15.2+cu117)
ERROR: No matching distribution found for torchvision==0.14.1+cu117
(oneposeplus) mona@ard-gpu-01:~$ nvidia-smi
Fri May 26 18:16:44 2023       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 530.30.02              Driver Version: 530.30.02    CUDA Version: 12.1     |
|-----------------------------------------+----------------------+----------------------+
| 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  NVIDIA GeForce RTX 3080 L...    On | 00000000:01:00.0 Off |                  N/A |
| N/A   51C    P8               16W /  90W|     50MiB / 16384MiB |     11%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      2519      G   /usr/lib/xorg/Xorg                           45MiB |
|    0   N/A  N/A      2960      G   ...libexec/gnome-remote-desktop-daemon        3MiB |
+---------------------------------------------------------------------------------------+
(oneposeplus) mona@ard-gpu-01:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:49:14_PDT_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0

(oneposeplus) mona@ard-gpu-01:~$ python
Python 3.11.3 (main, Apr 19 2023, 23:54:32) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.


CUDA11.7 installation instructions from here

You are trying to install older torch, torchvision, and torchtext releases with Python==3.11, which was just recently added.
Downgrade Python to e.g. 3.10 and it should work.

1 Like

Thank you. It worked as you mentioned:

(base) mona@ard-gpu-01:~$ conda create -n oneposeplus python=3.10
(base) mona@ard-gpu-01:~$ conda activate oneposeplus
(oneposeplus) mona@ard-gpu-01:~$ python -m pip install -U scikit-image[optional]
(oneposeplus) mona@ard-gpu-01:~$ pip install -U torch==1.13.0+cu117 torchtext==0.14.0 torchvision==0.14.0 --extra-index-url https://download.pytorch.org/whl/cu117

(oneposeplus) mona@ard-gpu-01:~$ python
Python 3.10.11 (main, Apr 20 2023, 19:02:41) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.13.0+cu117'
>>> import torchvision
>>> torchvision.__version__
'0.14.0+cu117'
>>> import torchtext
>>> torchtext.__version__
'0.14.0'