Has anyone ever run Pytorch on a Raspberry Pi 3 successfully? I have Pytorch and Torch on mine, and when I import the following in Python 3.5.3:
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
I get:
Traceback (most recent call last):
File “/home/pi/pytorch/tester.py”, line 1, in
import torch
File “/home/pi/pytorch/torch/init.py”, line 13, in
from .version import version
ImportError: No module named ‘torch.version’
Can anybody help? Thank you in advance for your time.
I tried so many different ways to get it to work, but alas, I will have to wait, till Pytorch is easier to be put on something like the Raspberry Pi. Guess Ill just continue with Tensorflow. Was looking forward to Pytorch on RPi, but it just seemed like trying to climb a waterfall. Thank you very much for help. You are AWESOME!!
I had the same issue compiling Pytorch on a Raspberry Pi 1 B.
Even though I added NO_DISTRIBUTED=1, it still wanted to compile gloo, crashing with the same error.
I dug through the code a bit and found the line, in which the gloo build was started.
In pytorch/torch/lib/build_libs.sh, line 162-173:
# Build
for arg in "$@"; do
if [[ "$arg" == "nccl" ]]; then
build_nccl
elif [[ "$arg" == "gloo" ]]; then
build gloo $GLOO_FLAGS
elif [[ "$arg" == "ATen" ]]; then
build_aten
else
build $arg
fi
done
Apparently the build gloo $GLOO_FLAGS line was called, even though NO_DISTRIBUTED was set.
Since I couldn’t figure out, which script called it, I just commented out the line, added a simple echo 'Would build gloo' instead, and it worked!
I will try to figure out why the line is still called, even though gloo shouldn’t be built.
Your tester.py script is in the pytorch source directory. So the import torch statement is trying to import the local folder torch. Try to place the tester.py anywhere except the pytorch source directory and this error should go away.
I think in your case the crucial detail is that either
you forgot to export NO_DISTRIBUTED=1 or
you did sudo python setup.py install instead of sudo -E python setup.py install (notice the -E). If you don’t use the E flag, python will not receive the NO_DISTRIBUTED variable and attempt to build the gloo library which is needed for distributed computing.
Hi,
I’m working on various DIY projects in putting torch model on a Raspberry Pi3 B, OS Raspbian. It is fun & cheap. Searched over internet, not found a reliable instruction in building pytorch in armv7l. After some trial-and-error, I could build the PyTorch 0.5.0 on RPi3. I upload the wheel to PyPi.
If you are interested, may download to your RPi3 & install. Here is the dependencies, sudo apt-get install libatlas-base-dev libopenblas-dev cython libatlas-dev m4 libblas-dev python3-dev cmake python3-yaml sudo pip install --upgrade numpy
numpy 1.14.3
Hi…I am super excited about PyTorch, it is a super project, a very promising one! I will definitely give it a try and follow it with attention.
In the other hand, TensorFlow is much more mature, documented and there is already tons of tutorials and articles about it. This, is to me, more important for someone asking such a question.
Ask me in a year and I would compare performances, features etc. But for now, I would recommend TensorFlow.