Import torchvision fails on NVIDIA jetson orin nano

username: cadip92
cooked: <p>Hello,</p>
<p>I am trying to install pytorch and torchvision on my nvidia jetson orin nano. I have referred this guide : <a href="https://docs.nvidia.com/deeplearning/frameworks/install-pytorch-jetson-platform/index.html#benefits" class="inline-onebox" rel="noopener nofollow ugc">Installing PyTorch for Jetson Platform - NVIDIA Docs</a></p>
<p>Device : NVIDIA Jetson Orin Nano<br>
Jetpack : 5.1.3<br>
Python : 3.8<br>
Pytorch : 2.0.0<br>
torchvision : 0.15.1 (also tried 0.15.2)</p>
<p>Here are the flags during compilation of torchvision:</p>
<p>Building wheel torchvision-0.15.1<br>
Compiling extensions with following flags:<br>
FORCE_CUDA: False<br>
DEBUG: False<br>
TORCHVISION_USE_PNG: True<br>
TORCHVISION_USE_JPEG: True<br>
TORCHVISION_USE_NVJPEG: True<br>
TORCHVISION_USE_FFMPEG: True<br>
TORCHVISION_USE_VIDEO_CODEC: True<br>
NVCC_FLAGS:<br>
Found PNG library<br>
Building torchvision with PNG image support<br>
libpng version: 1.6.37<br>
libpng include path: /usr/include/libpng16<br>
Running build on conda-build: False<br>
Running build on conda: False</p>
<p>torchvision is installed correctly but, when i run import torchvision, to verify the installation, I get the below error:</p>
<p>$python -c “import torchvision; print(torchvision.<strong>version</strong>)”<br>
Traceback (most recent call last):<br>
File “”, line 1, in <br>
File “/home/chandorkar/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/<strong>init</strong>.py”, line 6, in <br>
from torchvision import datasets, io, models, ops, transforms, utils<br>
File “/home/chandorkar/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/datasets/<strong>init</strong>.py”, line 1, in <br>
from ._optical_flow import FlyingChairs, FlyingThings3D, HD1K, KittiFlow, Sintel<br>
File “/home/chandorkar/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/datasets/_optical_flow.py”, line 13, in <br>
from .utils import _read_pfm, verify_str_arg<br>
File “/home/chandorkar/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/datasets/utils.py”, line 22, in <br>
import requests<br>
File “/home/chandorkar/.local/lib/python3.8/site-packages/requests-2.32.3-py3.8.egg/requests/<strong>init</strong>.py”, line 43, in <br>
import urllib3<br>
File “/home/chandorkar/.local/lib/python3.8/site-packages/urllib3-2.3.0-py3.8.egg/urllib3/<strong>init</strong>.py”, line 14, in <br>
from . import exceptions<br>
File “/home/chandorkar/.local/lib/python3.8/site-packages/urllib3-2.3.0-py3.8.egg/urllib3/exceptions.py”, line 26, in <br>
_TYPE_REDUCE_RESULT = tuple[typing.Callable[…, object], tuple[object, …]]<br>
TypeError: ‘type’ object is not subscriptable</p>

username: mycul
cooked: <p>So it looks like urllib3 2.3.0 removed support for python 3.8</p>
<p>link to changelog:</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://urllib3.readthedocs.io/en/stable/changelog.html">
  <header class="source">
      <img src="https://urllib3.readthedocs.io/en/stable/_static/favicon.png" class="site-icon" width="16" height="16">

      <a href="https://urllib3.readthedocs.io/en/stable/changelog.html" target="_blank" rel="noopener nofollow ugc">urllib3</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://urllib3.readthedocs.io/en/stable/changelog.html" target="_blank" rel="noopener nofollow ugc">Changelog</a></h3>

  <p>2.3.0 (2024-12-22): Features: Added HTTPResponse.shutdown() to stop any ongoing or future reads for a specific response. It calls shutdown(SHUT_RD) on the underlying socket. This feature was sponso...</p>


  </article>

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

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

<p>Potential solutions:</p>
<ul>
<li>downgrading your urllib3&lt;2</li>
<li>upgrading your python version to &gt;3.8</li>
</ul>
<p>This was all I could find at the moment. Hope this helps!</p>

username: cadip92
cooked: <p>Thank you <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> This helped me resolve my issue.</p>