Pytorch Lightning set up on Jetson Nano/Xavier NX

Hi there,

I’m currently trying to set up Pytorch Lightning on Jetson Nano/Jetson Xavier NX by building from source. So far, I have tried following this thread here:
https://github.com/PyTorchLightning/pytorch-lightning/issues/695

The requirements.txt has been changed and no longer has torchvision and scikit-learn as one of the requirements. However, it seems to seek a torch version>=1.4 as a result of torchmetrics>=0.2.0 (within requirements.txt). My Jetson even has torch 1.8.0 and torchvision in its pip3 package manager. I was wondering if anyone has successfully set Pytorch Lightning up on ARM64’s new requirement layout. Thanks!

Is there something I’m missing? I have also tried running setup.py to no avail. Thanks!

Expected behavior

My pip install attempt:

my pip install requirements attempt:

my pip list:
Selection_005

Environment

This is not a script bug as I’m only having trouble with setup using the pip package manager on Jetson/ARM64. The original post of mine is here:

When I find a solution, I will likely update every one of my posts with an extensive solution to the issue. Thanks!

Additional context

  • PyTorch Version (e.g., 1.0): 1.8.0
  • OS (e.g., Linux): Linux
  • How you installed PyTorch ( conda , pip , source): pip
  • Build command you used (if compiling from source): pip3 install pytorch-lighting/pip3 install -r requirements.txt
  • Python version: 3.6.9
  • CUDA/cuDNN version: CUDA 10.2, cuDNN 8.0.0
  • GPU models and configuration:
  • Any other relevant information:

Hi,

Which JetPack version do you use?

We try PyTorch Lightning on JetPack 4.5.1. with PyTorch v1.8.0 package from the below topic.

Everything works well without error.
Could you also give it a try?

$ pip3 install pytorch-lightning
...
Successfully installed PyYAML-5.4.1 aiohttp-3.7.4.post0 async-timeout-3.0.1 attrs-21.2.0 fsspec-2021.4.0 idna-ssl-1.1.0 multidict-5.1.0 packaging-20.9 pyDeprecate-0.3.0 pyparsing-2.4.7 pytorch-lightning-1.3.0 tensorboard-2.4.1 torchmetrics-0.3.1 tqdm-4.60.0 yarl-1.6.3

Thanks.

Hi there,
Thank you for the response! My l4t version on my Jetson Xavier NX is as follows:

$ dpkg-query --show nvidia-l4t-core
nvidia-l4t-core	32.5.1-20210219084708

More information here:


I believe the l4t version corresponds to Jetpack 4.5.1, As per:

So the l4t version should be 32.5.1. When I do the same commands, it yields the following error:

$ pip3 install pytorch-lightning

I ended up fixing the problem. In short, the problem seemed to be that either the torch version that I possessed was not 1.4.0, or that I needed to use pip instead of pip3. For some reason, pip installed for both pip python 2 and pip3. I would invite other people to evaluate this further. This is a rundown of my documentation on the process:

Pytorch Lightning Setup on Jetson Xavier NX

The general theme seems that we need to install pytorch lightning with the Pip package manager instead of pip3

and/or that we need to have torch 1.4.0 with its corresponding torchvision in order to pass the torch>=1.4 requirement


Not sure which, but it seemsl ike having both also works

1. We need to retrieve the Pytorch Variant 1.4.0 and torchvision 0.5.0 (Torch needs to bne >=1.4 but it seems 1.4.0 may be necessary). Prior to this, we already possessed pip3 and a torch and torchvision installation corresponding to that.


$ wget https://nvidia.box.com/shared/static/1v2cc4ro6zvsbu0p8h6qcuaqco1qcsif.whl -O torch-1.4.0-cp27-cp27mu-linux_aarch64.whl

$ git clone --branch v0.5.0 https://github.com/pytorch/vision torchvision # see below for version of torchvision to download

2. We will need both pip and pip3 to install pytorch lightning


$ sudo apt-get update

$ sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran

$ sudo apt-get install python-pip

$ sudo pip3 install -U pip testresources setuptools==49.6.0 # This step wasn't necessary but was done during the installation process for python 2 pip

3. Once we have the pip package manager, we need to install torch 1.4.0 on out python 2 environment. We also need to edit the Requirements.txt within pytorch-lightning environment


$ cd torchvision

$ export BUILD_VERSION=0.5.0

$ python3 setup.py install --user

$ cd path/to/pytorch-lightning

open requirements.txt..

Comment out the torch>=1.4 constraint as follows:

numpy>=1.17.2

#torch>=1.4 <---------------------------------------------------------------

future>=0.17.1 # required for builtins in setup.py

tqdm>=4.41.0

PyYAML>=5.1,<=5.4.1

fsspec[http]>=2021.4.0

tensorboard>=2.2.0, !=2.5.0 # 2.5.0 GPU CI error: 'Couldn't build proto file into descriptor pool!'

torchmetrics>=0.2.0

pyDeprecate==0.3.0

packaging

4. Install (The pip install seems to also install for pip3 manager)


$ pip install pytorch-lightning # Valid for both pip and pip3

5. We can continue to verify with pip list


$ pip3 list

$ pip list

It’s difficult to screencap these results using shutter with highlighted similarities, but your pip and pip3 list should look the same with the following and the same versions:
Selection_013
Selection_014

Sources

Pytorch and Torchvision installation for Python 2 and 3:

Python 2 pip installation:

https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html

Pytorch Lightning forum post (seems correct to a degree but non-working for us):

Pytorch Lightning installation (A note article by USAEng on ptl installation):