I followed the steps as per below link to build torchvision against python 3.9 on my Jetpack 5.1.2:
**$ sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libopenblas-dev libavcodec-dev libavformat-dev libswscale-dev**
**$ git clone --branch v0.16.2 https://github.com/pytorch/vision torchvision # see below for version of torchvision to download**
**$ cd torchvision**
**$ export BUILD_VERSION=0.16.2 # where 0.x.0 is the torchvision version **
**$ python3.9 setup.py install --user**
**$ cd ../ # attempting to load torchvision from build dir will result in import error**
But I am getting below error when I import âtorchvisionâ after installing it.
root@linux:/home/cabs-willet/Downloads/torchvision# pip show torchvision
Name: torchvision
Version: 0.16.2
Summary: image and video datasets and models for torch deep learning
Home-page: GitHub - pytorch/vision: Datasets, Transforms and Models specific to Computer Vision
Author: PyTorch Core Team
Author-email: soumith@pytorch.org
License: BSD
Location: /root/.local/lib/python3.9/site-packages/torchvision-0.16.2-py3.9-linux-aarch64.egg
Requires: numpy, pillow, requests, torch
Required-by:
root@linux:/home/cabs-willet/Downloads/torchvision# python3
Python 3.9.5 (default, Nov 23 2021, 15:27:38)
[GCC 9.3.0] on linux
Type âhelpâ, âcopyrightâ, âcreditsâ or âlicenseâ for more information.
import torchvision
Traceback (most recent call last):
File ââ, line 1, in
File â/home/cabs-willet/Downloads/torchvision/torchvision/init.pyâ, line 6, in
from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils
File â/home/cabs-willet/Downloads/torchvision/torchvision/datasets/init.pyâ, line 1, in
from ._optical_flow import FlyingChairs, FlyingThings3D, HD1K, KittiFlow, Sintel
File â/home/cabs-willet/Downloads/torchvision/torchvision/datasets/_optical_flow.pyâ, line 10, in
from PIL import Image
File â/usr/lib/python3/dist-packages/PIL/Image.pyâ, line 69, in
from . import _imaging as core
ImportError: cannot import name â_imagingâ from âPILâ (/usr/lib/python3/dist-packages/PIL/init.py)
Yes. With the installation of Pillow with the below command, I was able to fix the Torchvision error issue while importing.
$python3.9 -m pip install --user --upgrade Pillow
Thanks for this link. However, I was already able to see a already prebuilt wheel file for tensorflow for Linux basedArm64) in the below link. I was able to successfully install this wheel file and install Tensor Flow.
However, I was able to install that tensor flow wheel file for python 3.9 and it got installed successfully.
I check with âimport tensorflowâ command in the python3 prompt. It did not give any error. Does it prove, that its built with CUDA successfully?