Raspberry Pi 3?

username: Bunnisher
cooked: <p>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:</p>
<p>import torch<br>
from torch.autograd import Variable<br>
import torch.nn as nn<br>
import torch.nn.functional as F</p>
<p>I get:</p>
<p>Traceback (most recent call last):<br>
File “/home/pi/pytorch/tester.py”, line 1, in <br>
import torch<br>
File “/home/pi/pytorch/torch/<strong>init</strong>.py”, line 13, in <br>
from .version import <strong>version</strong><br>
ImportError: No module named ‘torch.version’</p>
<p>Can anybody help?  Thank you in advance for your time.</p>

username: colesbury
cooked: <p>Did you install PyTorch from source? <code>setup.py</code> creates a <code>version.py</code> file in torch/version.py. It should look like:</p>
<pre><code class="lang-auto">__version__ = '0.2.0+53fe804'
debug = False
cuda = '8.0.61'
</code></pre>
<p>depending on your build setup but you should definitely have a line that says <code>__version__ = ...</code></p>
<p>Re-run <code>setup.py</code> and make sure the file is being created.</p>

username: Bunnisher
cooked: <p>Colesbury,</p>
<p>Thank you so much for your time.</p>
<p>I did re-run <a href="http://setup.py" rel="nofollow noopener">setup.py</a>, but after installing yaml, and gloo, I got the following:</p>
<p>CMake Error at CMakeLists.txt:7 (message):<br>
Gloo can only be built on 64-bit systems.</p>
<p>– Configuring incomplete, errors occurred!<br>
See also “/home/pi/pytorch/torch/lib/build/gloo/CMakeFiles/CMakeOutput.log”.</p>
<p>I mean, I have downloaded both pytorch and torch, so I dont get it:</p>
<p>Desktop     nltk_data             python_games<br>
Documents   opencv-3.2.0          pytorch<br>
Downloads   opencv_contrib-3.2.0  RPi_Cam_Web_Interface<br>
<a href="http://get-pip.py" rel="nofollow noopener">get-pip.py</a>  opencv_contrib.zip    scikit-learn<br>
media       opencv.zip            Templates<br>
mu          Pictures              tensorflow-1.0.1-cp27-none-linux_armv7l.whl<br>
Music       Public                tensorflow-for-poets-2<br>
nesBot      Python-3.6.0          torch<br>
newsBot     Python-3.6.0.tar.xz   Videos</p>
<p>:_(</p>

username: colesbury
cooked: <p>Gloo shouldn’t be required your use case. (It’s a library for distributed training).</p>
<p>Use <code>export NO_DISTRIBUTED=1</code> before re-running <a href="http://setup.py">setup.py</a>. (Also make sure you run <code>setup.py clean</code> first since you will be changing what should be built)</p>

username: Bunnisher
cooked: <p>Hey Colesbury,</p>
<p>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!!</p>
<p>Best regards,</p>

username: ptrblck
cooked: <p>I had the same issue compiling Pytorch on a Raspberry Pi 1 B.<br>
Even though I added <code>NO_DISTRIBUTED=1</code>, it still wanted to compile gloo, crashing with the same error.</p>
<p>I dug through the code a bit and found the line, in which the gloo build was started.</p>
<p>In <code>pytorch/torch/lib/build_libs.sh</code>, line 162-173:</p>
<pre><code># 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
</code></pre>
<p>Apparently the <code>build gloo $GLOO_FLAGS</code> line was called, even though <code>NO_DISTRIBUTED</code> was set.<br>
Since I couldn’t figure out, which script called it, I just commented out the line, added a simple <code>echo 'Would build gloo'</code> instead, and it worked! <img src="//discuss.pytorch.org/images/emoji/apple/smiley.png?v=5" title=":smiley:" class="emoji" alt=":smiley:"></p>
<p>I will try to figure out why the line is still called, even though gloo shouldn’t be built.</p>

username: Nabarun_Goswami
cooked: <p>Hi</p>
<p>Your <a href="http://tester.py" rel="nofollow noopener">tester.py</a> script is in the pytorch source directory. So the import torch statement is trying to import the local folder torch. Try to place the <a href="http://tester.py" rel="nofollow noopener">tester.py</a> anywhere except the pytorch source directory and this error should go away.</p>
<p>Cheers<br>
Nabarun</p>

username: Mario_Parreno
cooked: <p>Hi, anyone can help me to be able to do work Pytorch on Raspberry Pi model B with stretc lite? (Sorry about my english :D)</p>
<p>I am trying to install pytorch on the raspberry following this: <a href="http://book.duckietown.org/master/duckiebook/pytorch_install.html" rel="nofollow noopener">http://book.duckietown.org/master/duckiebook/pytorch_install.html</a></p>
<p>I have installed python-typing, cmake, python-… all necessary. But after one hour always has a fail <img src="https://discuss.pytorch.org/images/emoji/apple/frowning.png?v=5" title=":frowning:" class="emoji" alt=":frowning:"></p>

username: flogo
cooked: <p><a class="mention" href="/u/mario_parreno">@Mario_Parreno</a> I wrote a new (slightly shorter) tutorial for installing PyTorch on RPi3.<br>
Available here: <a href="https://gist.github.com/fgolemo/b973a3fa1aaa67ac61c480ae8440e754" rel="nofollow noopener">https://gist.github.com/fgolemo/b973a3fa1aaa67ac61c480ae8440e754</a></p>
<p>I think in your case the crucial detail is that either</p>
<ul>
<li>you forgot to <code>export NO_DISTRIBUTED=1</code> or</li>
<li>you did <code>sudo python setup.py install</code> instead of <code>sudo -E python setup.py install</code> (notice the <code>-E</code>). If you don’t use the <code>E</code> flag, python will <strong>not</strong> receive the <code>NO_DISTRIBUTED</code> variable and attempt to build the gloo library which is needed for distributed computing.</li>
</ul>
<p>Could you give it another try, please?</p>

username: emailcontactin2004
cooked: <p>Hi,<br>
I’m working on various DIY projects in putting torch model on a Raspberry Pi3 B, OS Raspbian. It is fun &amp; 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.<br>
<aside class="onebox whitelistedgeneric">
  <header class="source">
      <img src="https://pypi.org/static/images/favicon.6a76275d.ico" class="site-icon" width="32" height="30">
      <a href="https://pypi.org/project/rpi3.torch/" target="_blank" rel="nofollow noopener">PyPI</a>
  </header>
  <article class="onebox-body">
    <img src="https://pypi.org/static/images/twitter.c0030826.jpg" class="thumbnail onebox-avatar" width="300" height="300">

<h3><a href="https://pypi.org/project/rpi3.torch/" target="_blank" rel="nofollow noopener">rpi3.torch</a></h3>

<p>PyTorch in Raspberry Pi3 B, py35, armv7l</p>


  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>
<br>
If you are interested, may download to your RPi3 &amp; install. Here is the dependencies,<br>
<code>sudo apt-get install libatlas-base-dev libopenblas-dev cython libatlas-dev m4 libblas-dev python3-dev cmake python3-yaml</code><br>
<code>sudo pip install --upgrade numpy</code><br>
numpy 1.14.3</p>
<p>Have fun. <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=5" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>

username: DunnPenny
cooked: <p>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.<br>
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.<br>
Ask me in a year and I would compare performances, features etc. But for now, I would recommend TensorFlow.</p>
<p><a href="https://www.7pcb.ca/contact-us/" rel="nofollow noopener">pcb assembly canada</a></p>

username: LeviViana
cooked: <p>Torch 1.4 wheels for Raspberry Pi are now available here -&gt; <a href="https://discuss.pytorch.org/t/installing-pytorch-on-raspberry-pi-3/25215/14" class="inline-onebox">Installing pytorch on raspberry pi 3</a></p>

username: d4l3k
cooked: <p>PyTorch provides official wheels for arm64/aarch64 so if you install the newly released RPi OS 64-bit you can just run:</p>
<pre><code class="lang-auto">pip install torch torchvision torchaudio
</code></pre>
<p>I wrote up a tutorial on how to do efficient real time inference on a Raspberry Pi at <a href="https://pytorch.org/tutorials/intermediate/realtime_rpi.html" rel="noopener nofollow ugc">Real Time Inference on Raspberry Pi 4 (30 fps!) — PyTorch Tutorials 1.10.1+cu102 documentation </a></p>