PyTorch for Jetson

I’m sorry, I don’t currently (but I hope to setup an automated PyTorch builder for jetson-containers soon-ish to help others with things like this. In the meantime, have you tried disabling zram, mounting more swap (ideally on NVME), and disabling the GUI?

https://github.com/dusty-nv/jetson-containers/blob/master/docs/setup.md#mounting-swap

I think you can also have PyTorch run less parallel compiling jobs at once, maybe that could help?

i installed pytorch 1.10.0 and torchvison 0.11.1,but why it tell me pytorch and torchvision versions are incompatible ?

MY Jetpack version is 5.1.1, L4T version is 35.3.1 ,cuda version is 11.4, I need to download which pytorch?

Hi @19565337738, you should be able to use these:

PyTorch v2.1.0

PyTorch v2.0.0

Hi buptwlr, run the commands below to install torchvision. It is installed from source:

$ git clone https://github.com/pytorch/vision
$ cd vision
$ sudo python setup.py install

The latest version of torchvision will not compile due to a change in torchvision/_meta_registrations.py which now does an import torch._custom_ops which is not present in the current nVidia CUDA version of torch.

The last working version was v0.16.0-rc5 and the last non-rc version was v0.15.0, which you can get by doing:

git checkout v0.16.0-rc5
or
git checkout v0.15.2 (I did not try this version, so YMMV)

as you see fit.

$ git clone https://github.com/pytorch/vision
$ cd vision
$ git checkout v0.16.0-rc5
$ sudo python setup.py install

Hi! How to solution the problem I don’t built torchvision 0.15.1
When I run “Python setup.py install”, it didn’t work for me.
It will error

Error:No such file or directory: ‘/user/local/coda-11/bin/nvcc

I built Torch-1.14.0a0+44dac51c.nv23 .02-cp38-cp38-Linux_arrch64.whl on Jetpack 5.1 on virtual environment

nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Sun_Oct_23_22:16:07_PDT_2022
Cuda compilation tools, release 11.4, V11.4.315
Build cuda_11.4.r11.4/compiler.31964100_0

@3a817021 try it outside of virtual environment, in torchvision container, or try setting CUDA_HOME=/usr/local/cuda

@dusty_nv is there a PyTorch wheel yet for Jetpack 5.1.2 ?

1 Like

@hg1 yes sorry, the PyTorch 2.1 at the top should have included JP 5.1.2 in the description, although the PyTorch 2.0 wheel works good on 5.1.2 too.

I am getting this error when installing torchvision. I currently have 2 CUDA versions (11.4 and 12.2) but I would like to use the 12.2 version since I am working on a project that doesn’t support CUDA 11.4 version.

RuntimeError:
The detected CUDA version (12.2) mismatches the version that was used to compile
PyTorch (11.4). Please make sure to use the same CUDA versions.

I already updated the .bashrc file:

export PATH=/usr/local/cuda-12.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

I also encountered this error when installing Pytorch though it’s successfully installed after this:

ERROR: Invalid requirement: 'LD_LIBRARY_PATH=/usr/lib/llvm-8/lib:/usr/local/cuda-12.2/lib64'
Hint: It looks like a path. File 'LD_LIBRARY_PATH=/usr/lib/llvm-8/lib:/usr/local/cuda-12.2/lib64' does not exist.

Hi! Thanks for your reply, I tried your method to change the cuda path. However, the problem is exist, I unable to install suitable version of torchvision.

Hi @SeraphinaAki, you would also need to compile PyTorch against CUDA 12.2.

Hi @3a817021, is /usr/local/cuda/bin in your environment’s $PATH ? You might also just want to try l4t-pytorch container, it already has torchvision built/installed in it.

Could you provide me the link on how to compile torch-2.0.0+nv23.05 version with CUDA 12.2? Your assistance is greatly appreciated. Thank you!

Hi @SeraphinaAki, I haven’t tried it with CUDA 12.2, but there are instructions at the top of this post (under the Build from source section) for building PyTorch from source. At this point, I would probably go with PyTorch 2.1.

1 Like

如果我使用torch 2.0 ,那我的torchvision 应该下载那个版本的

如果使用的torch版本是2.1.0 那我torchvision要装哪个版本的呢,请您告诉我

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-1xi8ijvy/pyzmq/
I am getting this command when i tried the pip3 install jupyter code

Hi @simon1981jain, are you trying to install PyTorch or Jupyter? If you’re trying to install JupyterLab on Jetson Nano, you can follow a tutorial like below, or use jupyterlab container (you can also use l4t-ml container, which has jupyter + PyTorch/tensorflow/ect already installed)

Thank you so much for your reply. I was trying to install jupyter.


我的orain nano 上安装的torch2.0.0 ,安装torchvision 时,安装他依赖的一些文件时会自动移除了一些系统文件,导致我系统崩溃,我如何下载torchvision0.15.1版本呢,怎么解决这个问题