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

username: Mona_Jalal
cooked: <p>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</p>
<pre><code class="lang-auto">(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.


</code></pre>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://pytorch.org/get-started/previous-versions/">
  <header class="source">
      <img src="https://pytorch.org/favicon.ico?" class="site-icon" width="32" height="32">

      <a href="https://pytorch.org/get-started/previous-versions/" target="_blank" rel="noopener nofollow ugc">pytorch.org</a>
  </header>

  <article class="onebox-body">
    <img src="https://pytorch.org/assets/images/pytorch-logo.png" class="thumbnail onebox-avatar" width="500" height="500">

<h3><a href="https://pytorch.org/get-started/previous-versions/" target="_blank" rel="noopener nofollow ugc">PyTorch</a></h3>

  <p>An open source machine learning framework that accelerates the path from research prototyping to production deployment.</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>CUDA11.7 installation instructions from here</p><aside class="onebox githubgist" data-onebox-src="https://gist.github.com/primus852/b6bac167509e6f352efb8a462dcf1854">
  <header class="source">

      <a href="https://gist.github.com/primus852/b6bac167509e6f352efb8a462dcf1854" target="_blank" rel="noopener nofollow ugc">gist.github.com</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://gist.github.com/primus852/b6bac167509e6f352efb8a462dcf1854" target="_blank" rel="noopener nofollow ugc">https://gist.github.com/primus852/b6bac167509e6f352efb8a462dcf1854</a></h4>

  <h5>cuda_11.7_installation_on_Ubuntu_22.04</h5>
  <pre><code class="Shell">#!/bin/bash

### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###

### to verify your gpu is cuda enable check</code></pre>
    This file has been truncated. <a href="https://gist.github.com/primus852/b6bac167509e6f352efb8a462dcf1854" target="_blank" rel="noopener nofollow ugc">show original</a>

<p>
</p>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>


username: ptrblck
cooked: <p>You are trying to install older <code>torch</code>, <code>torchvision</code>, and <code>torchtext</code> releases with Python==3.11, which was just recently added.<br>
Downgrade Python to e.g. 3.10 and it should work.</p>

username: Mona_Jalal
cooked: <p>Thank you. It worked as you mentioned:</p>
<pre><code class="lang-auto">(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.
&gt;&gt;&gt; import torch
&gt;&gt;&gt; torch.__version__
'1.13.0+cu117'
&gt;&gt;&gt; import torchvision
&gt;&gt;&gt; torchvision.__version__
'0.14.0+cu117'
&gt;&gt;&gt; import torchtext
&gt;&gt;&gt; torchtext.__version__
'0.14.0'

</code></pre>