Error when installing torchvision 0.12.0 on jetson xazier nx

hi, my jetpack is 5.0.1. I want to constructe an environment for pytorch and I have installed torch1.11 successfully on jetson xazier nx , but error occors when installing torchvision. First, I used command ‘git clone --branch v0.12.0 GitHub - pytorch/vision: Datasets, Transforms and Models specific to Computer Vision torchvision’ to download torchvision. Then, I used ‘python setup.py install’ for installation. Here is the error:
(torch) nx@ubuntu:~/Downloads/torch11.1-torchvision0.12/torchvision$ python setup.py install --user
Building wheel torchvision-0.12.0
Traceback (most recent call last):
File “setup.py”, line 532, in
ext_modules=get_extensions(),
File “setup.py”, line 262, in get_extensions
libpng = distutils.spawn.find_executable(“libpng-config”)
AttributeError: module ‘distutils’ has no attribute ‘spawn’
I’m sincerely looking forward to your reply.

Hi @xingq1019, does it work if you run python3 setup.py install --user instead?

If you continue having issues, you might also want to try the l4t-pytorch container which comes with PyTorch + torchvision pre-installed.

Command ‘python3 setup.py install --user’ doesn’t work for me. And I guess it’s a python version problem. The reason is when I run ‘python3’ and ‘import torch’, it outputs the version of the torch which is 1.11.0, then I run ‘sudo python3 setup.py install’, error is “No module named torch”. It is super weird especially after two times successful installation before.

Hmm, my guess is that torch package got installed for your user, and not system wide. You could try uninstalling torch, and then re-installing the torch wheel again with sudo pip3 install ... or try building torchvision without sudo.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.