HOW TO INSTALL PYTORCH IN YOUR RASPBERRY PI 4
- vidyakamath1004
- May 3, 2023
- 1 min read
Follow the following steps
sudo apt-get upgrade python
pip3 install pyserialCheck your ARM architechture using the below command.
uname -a You must find that your using aarch64 if your running it on a Raspberry Pi 4.
Next find if your using bullseye version or the buster version of Rasbian using following.
cat /etc/os-releaseNext, download the wheel files for torch library and for your torchvision library using the following links.
FOR TORCH 1.13.0
#bullseye
https://drive.google.com/uc?id=1uLkZzUdx3LiJC-Sy_ofTACfHgFprumSg
#buster
https://drive.google.com/uc?id=1FQw6NgT9k3paiAhEbq0ibkVSIGNLAyro
FOR TORCHVISION 0.14.0
#bullseye
https://drive.google.com/uc?id=1AhbkLqKd8EZO2pZV_g9aFZGHZo2Ubc3O
#buster
https://drive.google.com/uc?id=1m6wEbl_jJGaQL-vg4zkNfc9TNwl2_J4oNext install the dependencies.
sudo apt install libopenblas-dev libblas-dev m4 cmake Cython python3-dev python3-yaml python3-setuptools python3-wheel python3-pillow python3-numpyNow Copy the downloaded wheel files from PI->downloads to your working directory.
Example: the files for bullseye version after download are:
torch-1.13.0a0+git7c98e70-cp39-cp39-linux_aarch64.whl
torchvision-0.14.0a0+5ce4506-cp39-cp39-linux_aarch64.whl
Install torch using the wheel file as follows:
sudo -H pip3 install torch-1.13.0a0+git7c98e70-cp39-cp39-linux_aarch64.whlInstall torchvision using the wheel file as follows:
sudo -H pip3 install torchvision-0.14.0a0+5ce4506-cp39-cp39-linux_aarch64.whlTesting:
python3 >> import torch
>> import torchvision
>> (cntr + z to exit)



Comments