Hello AI World on Jetpack 4.4

I was able to run the Hello AI World lessons without issue on Jetpack 4.2. I have upgraded to Jetpack 4.4, and have a freshly flashed JP 4.4 card. Following Dusty’s tutorial, I do the following commands:

$ sudo apt-get update
$ sudo apt-get install git cmake libpython3-dev python3-numpy
$ git clone --recursive GitHub - dusty-nv/jetson-inference: Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.
$ cd jetson-inference
$ mkdir build
$ cd build
$ cmake …/
$ make -j$(nproc)
$ sudo make install
$ sudo ldconfig

At the point the dialog box appears for pytorch, I request pytorch be installed for python 3.6. After completing the steps above, I reboot and in a terminal window type:

python3

Then at the python command prompt, I type
import torch

I get the ModuleNotFoundError: No Module named ‘torch’
Similar for torchvision.

So, what worked for jetpack 4.2 no longer works for jetpack 4.4

Any help would be appreciated.
Paul McWhorter
www.toptechboy.com

1 Like

Hi,

Do you apply extra pyTorch installation steps?
Or just run the jetson_inference cmake and make command?

Thanks.

I do the installation steps exactly as indicated in Hello AI worlds instructions, that is these steps:

sudo apt-get update sudo apt-get install git cmake libpython3-dev python3-numpy
git clone --recursive GitHub - dusty-nv/jetson-inference: Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.
cd jetson-inference
mkdir build cd build
cmake …/ make -j$(nproc)
sudo make install
sudo ldconfig

I then type python3 to go to the python command line, and import torch results in module not found error. If I then follow the Hello AI world instructions for ‘install pytorch later’. I follow those instructions, which are:

cd jetson-inference/build
./install-pytroch.sh

I then get the message:

./install-pytorch.sh
[jetson-inference] BUILD_INTERACTVE=
[jetson-inference] non-interactive mode, skipping PyTorch install…

[jetson-inference] installation complete, exiting with status code 0
[jetson-inference] to run this tool again, use the following commands:

Going again to python3 command line, typing

import torch

I get the module not found error again.

Your help would be appreciated

Paul McWhorter
www.toptechboy.com

I’m currently fixing the install_pytorch.sh script to detect JetPack 4.4 and install the different pip wheels, sorry about that. It should be checked in later today. For now, you can install PyTorch manually from here: PyTorch for Jetson

OK, the install_pytorch.sh script has now been updated to install the PyTorch wheels for CUDA 10.2, sorry about that.

Please refer to this post for more information: https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-5-0-now-available/72048/291

1 Like

Confirming that this works now. Following the Hello AI World instructions with jetpack 4.4 results in working pytorch installation. Thanks!

I am following all installation steps as described in the Hello AI World lesson. In the lesson “Re-training on the Cat/Dog Dataset” when I try to “Re-training ResNet-18 Model” using the commands provided:
$ cd jetson-inference/python/training/classification
$ python train.py --model-dir=cat_dog ~/datasets/cat_dog

I get the following error:
Traceback (most recent call last):
File “train.py”, line 15, in
import torch
ImportError: No module named torch

When I installed PyTorch earlier, the logs indicated a “Successfully installed torch-1.4.0a0+7f73f1d”.

Some more detail:
I am running JetPack 4.4 on Jetson Xavier NX
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux

import torch
print(torch.version)
1.4.0a0+7f73f1d
print('CUDA available: ’ + str(torch.cuda.is_available()))
CUDA available: True

I would appreciate your help,
Regards

Hi @halimatif, it looks like you installed PyTorch for Python 3.6, but are attempting to run the script with Python 2.7.

If you change python to python3 when launching the script above, does it work?

Yes, it works! Thank you. Rookie mistake… I was literally following the exercise “Re-training ResNet-18 Model” listed steps without understanding the connection between “PyTorch for Python 3.6” and the “python” reference in the launch training command.

Thanks, glad you were able to get it running, and I will have to make a note of that in the documentation. More than likely I will move all the references over to python3 since Python 2.7 is EOL.