TorchVision not found error after successful installation

On my custom Xavier AGX board, I have managed to succesfully install Pytorch v. 1.9.0 using the instructions found here.

wget https://nvidia.box.com/shared/static/h1z9sw4bb1ybi0rm3tu8qdj8hs05ljbm.whl -O torch-1.9.0-cp36-cp36m-linux_aarch64.whl 
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev 
sudo pip3 install Cython
sudo pip3 install numpy torch-1.9.0-cp36-cp36m-linux_aarch64.whl

The following lines:

import torch
print  (torch.__version__)
torch.cuda.is_available()
torch.cuda.get_device_name(0)

produce this output:

1.9.0
True
‘Xavier’

So, I guess, PyTorch has been successfully installed.

I then went on to install the corresponding TorchVision version, i.e. 0.10.0:

sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev
git clone --branch release/0.10 https://github.com/pytorch/vision torchvision
cd torchvision
export BUILD_VERSION=0.10.0
sudo python3 setup.py install --user

Below is part of the output messages I got during installation:

Installed /home/nvidia/.local/lib/python3.6/site-packages/torchvision-0.10.0a0+ca1a620-py3.6-linux-aarch64.egg
Processing dependencies for torchvision==0.10.0a0+ca1a620
Searching for pillow>=5.3.0
Reading Links for Pillow
Downloading https://files.pythonhosted.org/packages/d0/57/4b81f4fb0f0f93425488fc4a4e77e34c946ff76a65722739cbad35ddfe34/Pillow-8.4.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl#sha256=72cbcfd54df6caf85cc35264c77ede902452d6df41166010262374155947460c
Best match: Pillow 8.4.0
Processing Pillow-8.4.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Installing Pillow-8.4.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl to /home/nvidia/.local/lib/python3.6/site-packages
Adding Pillow 8.4.0 to easy-install.pth file
Installed /home/nvidia/.local/lib/python3.6/site-packages/Pillow-8.4.0-py3.6-linux-aarch64.egg

Searching for torch==1.9.0
Best match: torch 1.9.0
Adding torch 1.9.0 to easy-install.pth file
Installing convert-caffe2-to-onnx script to /home/nvidia/.local/bin
Installing convert-onnx-to-caffe2 script to /home/nvidia/.local/bin

So, I guess that TorchVision installation is ok as well. But unfortunately this isn’t the case:

import torchvision

gives me the error:

Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘torchvision’

Does anyone can provide some hint on what could be the problem here?

Hi,

The log of torchvision only has the dependency part.
We cannot find the installation details (success or failure) about torchvision.

Is this all the output log?
If not, could you attach the complete output log for installing torchvision with us first?

Thanks.

Thanks for the reply.

It turns out the issue was due to TorchVision being installed in /home/nvidia/.local instead of /usr/local/lib/python3.6/dist-packages. .local was under root:root ownership. After I did a chown of .local to nvidia:nvidia problem was solved.

Any idea why .local folder was chosen by pip3 install?

Hi,

It depends on the authority when running the installation.

For example, with pip3 --user.
It may install the library under home since no permission to write the file under /usr/local/

Thanks.

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