Torchvision not found - Jetson Inference

Hi,

For transfer learning : https://github.com/dusty-nv/jetson-inference/blob/master/docs/pytorch-collect.md

I have installed pytorch using ./install-pytorch.sh. for python3.6.

When I run in my home directory

$ python3

import torch

import torchvision

I can see these both get imported without any errors.

While re-training model at :

$ cd jetson-inference/python/training/classification

$ python3 train.py --model-dir=(YOUR-MODEL) (PATH-TO-YOUR-DATASET)

I get the error : No module named ‘torchvision’
What could be the possible reason? Do I have to install torchvision separately?

Hmm. If you create a new python script with the following contents, are you able to run it ok?

import torch
import torchvision

Alternatively, if you also install PyTorch for Python 2.7 with install_pytorch.sh, does python train.py ... run ok for you?

Creating new python script and running gives the same error like :

No module named ‘torchvision’ but running Python3 (Version 3.6.9) on terminal and importing (Torch,Torchvision) gives no error!

Installing PyTorch for 2.7 gives error:

I followed the installation procedure same as shown on Github.

Which JetPack version are you on? Do you have python symbolically linked to a different python version than python 2.7?

If you want to try installing PyTorch+torchvision manually, you can find the PyTorch wheels and instructions here: https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-5-0-now-available/

This message from your screenshot I haven’t seen before: Defaulting to user installation because normal site-packages is not writeable

Is it possible that the permissions of that dir have been changed or corrupted somehow?

Hi Dusty,
Sorry for reaching out to you so late. To avoid all the confusions, I reflashed (Jetpack 4.4)whole device. I installed pytorch from the link you attached.

(I am only using TX2 for Jetson Inference and I haven’t installed or linked python to any other vesion)

I get following error:

Hi @arjunTX2, is it able to import torchvision ok, but not import torchvision.transforms?

What version of torchvision is listed if you print(torchvision.__version__)?

Hi @dusty_nv,
Sorry for the trouble. I have solved this problem.

I was ignoring the error of ‘’ Cache deserialization failed, entry ignored’’ while installing torch. I have removed cache folder and now it is working like charm :D.

Thanks alot.