Installing Pytorch on a raspberry pi 4

Earlier this year I had to install pytorch on a raspiberry pi for my robotic lawn mower project (more on that later). However, the process was very painful, so Ill throw my notes here in case anyone else tries to do the same. Its not supposed to be bullet-proof, but may help with some pointers. Updates to this proceudre may be found here.

Installed from wheel on these:

But for rpi4 there was some errors, so I installed a wheel after reading this comment:

Install from his wheel a bit longer down the thread, and rename those and files to and

Torchvision works, but Pillow 7.0.0 was too new, so downgraded to 6.1 after some random comments I found.


PIP install pytorch from wheel

Download wheel from here and run sudo pip3 install torch-1.1.0-cp37-cp37m-linux_armv7l.whl

Rename some files

Then if you try to run sudo python3 -c "import torch" you get:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/torch/", line 79, in <module>
    from torch._C import *
ModuleNotFoundError: No module named 'torch._C'

Can be fixed by the following:

cd /usr/local/lib/python3.7/dist-packages/torch
sudo mv
sudo mv


comments powered by Disqus