Having troubles Installing Pytorch on Jetson Xavier AGX

Hi, I’m trying to install Pytorch on Jetson Xavier AGX. I have download the wheel for PyTorch v1.11.0 from PyTorch for Jetson - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums, and I tried to install it with following commands :
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev libomp-dev
pip3 install Cython
pip3 install numpy torch-1.11.0-cp38-cp38-linux_aarch64.whl

Then I got the error message : torch-1.11.0-cp38-cp38-linux_aarch64.whl Is not a supported wheel on this platform, but I have confirmed that my Jetpack version is indeed 5.0.2 and my python version in my virtual environment is 3.8. Did I miss a step or install something? Please let me know if there is any suggestion. Thank you very much.

Hi @will46616, can you run pip3 --version to double-check that it is indeed Python 3.8, and that you downloaded the correct URL for that wheel. Also you might want to try installing it outside of virtual environment to see if that has any impact.

If you continue having issues, you could try one of the newer wheels or the l4t-jetpack container (which comes with PyTorch and torchvision pre-installed).

Thank you for your immediate reply. My pip3 version is “pip 23.0 from /home/nvidia/miniforge-pypy3/lib/pypy3.8/site-packages/pip (python 3.8)” . It is indeed python 3.8. The wheel that I downloaded is from this URL,PyTorch for Jetson . Did I use the correct URL? On the other hand, I have another question,. If I already had the Pytorch version 1.12.0a0+2c916ef.nv22.3 and torchvision version 0.12.0 on my Xavier AGX, how do I install torchaudio? I see only torch and torchvision tutorials on the internet.

Best regard.
Will

That’s the correct URL for the post, but double-check the link from which you downloaded the actual wheel. The wget command in that post references the URL of an older wheel (IIRC, PyTorch 1.8 for Python 3.6) and you should substitute the URL / filename of the wheel that you want.

I also wonder if the miniforge/virtualenv is conflicting with it in some way (I haven’t used these on Jetson/aarch64), so you may want to try installing the PyTorch wheel outside of those first.

The l4t-pytorch container comes with PyTorch/torchvision/torchaudio pre-installed, but you can see the commands that I ran to install torchaudio here: https://github.com/dusty-nv/jetson-containers/blob/59f840abbb99f22914a7b2471da829b3dd56122e/Dockerfile.pytorch#L92

Those RUN commands in the dockerfile are just normal bash commands that the docker builder runs, but you can manually run them outside of container if you want (without the RUN prefix or other environment variables that I set in the container). I also had to upgrade cmake and install other dependencies in order to build torchaudio, so you might just want to use the container to keep your environment clean if you so desire.

I see. I later used the l4t-pytorch container, and it works. Thanks. If I want to use other python package like Pyaudio or numpy, should I use dockerfile ?

It’s preferred to make your own Dockerfile that uses l4t-pytorch as the base image and then installs your required packages, yea. Then you can more easily change/rebuild/deploy it at anytime.

Alternatively, you can manually run the installation commands inside the container itself, and then do a docker commit to save your updated container to a new image tag. BTW, l4t-pytorch already has numpy installed, but you may want to add other stuff too.

Got it, I will learn how to make my own Dockerfile. Thank you again!

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