PyTorch for Jetson

@dusty_nv
I am trying to build the pytorch on jetson nano.when I try to download the wget link (wget https://nvidia.box.com/shared/static/veo87trfaawj5pfwuqvhl6mzc5b55fbj.whl -O torch-1.1.0a0+b457266-cp36-cp36m-linux_aarch64.whl) you have posted, but it occurs connection refused. could you share a google drive link or other available link. thank you.

Hi Perry, what happens if you try http://nvidia.box.com/shared/static/veo87trfaawj5pfwuqvhl6mzc5b55fbj.whl (without HTTPS)?

If that doesn’t work either, I will put it on Google Drive for you.

thank you for quick reply @dusty_nv.
this link is still unable to resolve. please put it on Google Drive, thx!

I have a faster-rcnn.pytorch model. The repository address for this project is: https://github.com/jwyang/faster-rcnn.pytorch. I want to port this model to jetson nano. Is there a tutorial for reference? .

The jetson I bought has already installed python 3.6 and JetPack 4.2, so I didn’t build any wheels according to “Build Instructions”.
I downloaded the swap partition just by following “Build Instructions”.
I downloaded the “torch-1.1.0a0+b457266-cp36-cp36m-linux_aarch64.whl” offline, and then used “pip3 install .whl” to install pytorch1.1. I also used the following command to the torchvision:
$ git clone GitHub - pytorch/vision: Datasets, Transforms and Models specific to Computer Vision
$ cd vision
$ sudo python setup.py install

But when I install scipy with “pip3 install scipy” it always fails.

Any help will be greatly appreciated.

zcy@zcy-desktop:~/0_projects/faster-rcnn.pytorch$ pip install Cython
Collecting Cython
  Downloading https://files.pythonhosted.org/packages/f8/da/c979464858b257b21a6472a85285548c91f5b4dc773cb049cfdfb3ceeb02/Cython-0.29.7.tar.gz (2.0MB)
    100% |████████████████████████████████| 2.0MB 45kB/s 
Building wheels for collected packages: Cython
  Building wheel for Cython (setup.py) ... done
  Stored in directory: /home/zcy/.cache/pip/wheels/79/b9/15/c589b51f4e91b37faa76362180166a2041e4286c38dbc45fc6
Successfully built Cython
Installing collected packages: Cython
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/cython.py'
Consider using the `--user` option or check the permissions.

Hi zcy, did you try installing this package with the --user flag to pip? And if that doesn’t work, by running pip with sudo permissions?

@zcy I’m having trouble installing scipy as well. Here is a thread about it https://devtalk.nvidia.com/default/topic/1049426/jetson-nano/using-pip3-pip-to-install-scipy-will-be-stuck/ .

thanks, it`s work.
By the way, is there an example of porting the pytorch model to jetson nano ?

Hi dusty, could you post the checksum for the wheel file (https://nvidia.box.com/shared/static/veo87trfaawj5pfwuqvhl6mzc5b55fbj.whl)? I download it multiple times and it’s still broken. (Got zipfile.BadZipFile: File is not a zip file error message).

1 Like

Connecting failed when downloading wheel for Python2.7.

wget https://nvidia.box.com/shared/static/m6vy0c7rs8t1alrt9dqf7yt1z587d1jk.whl -O torch-1.1.0a0+b457266-cp27-cp27mu-linux_aarch64.whl

Then it shows,

Connecting to nvidia.app.box.com (nvidia.app.box.com)|243.185.187.39|:443... failed:Operation timed out

I’ve tried to ping the IP address and always timed out.

Anyone with the same problem? thx.

The box.com is blocked by GFW. (box.com被墙了)
For those from China (a.k.a behind the GFW), You may download the wheel from my shared link:
Baidu NetDriver Link: 百度网盘 请输入提取码
Code : ribc

MD5 (torch-1.1.0a0+b457266-cp36-cp36m-linux_aarch64.whl) = a08c545c05651e6a9651010c13f3151f

Sorry I didn’t download python2 wheel. I prefer to use python3. Please email me if you insist to use python2 and can’t find a VPN to download the wheel from box.com

1 Like

Hi fengbo, here are the SHA256 and MD5 checksums for this file:

SHA256:  0e998c886be9d5e4f4d721053330d7da478baa1648e52c8a02da11d6251e7e73
MD5:  a08c545c05651e6a9651010c13f3151f

Have you tried downloading it from a different browser, or without HTTPS?
torch-1.1.0a0+b457266-cp36-cp36m-linux_aarch64.whl.sha256.txt (118 Bytes)
torch-1.1.0a0+b457266-cp36-cp36m-linux_aarch64.whl.md5.txt (86 Bytes)

1 Like

Can you let me know if you can access box.com link without using HTTPS, or does HTTP/HTTPS not matter with the GFW?

1 Like

Hi Dusty, thank you. I’ve downloaded the wheel from a proxy in Hongkong, and verified with MD5 checksum.
The box.com is blocked by China’s Great Fire Wall (GFW), either does Google driver (so can’t solve the problem even if you make a copy to Google driver). I put the python3’s wheel in Baidu driver and shared the link in this thread. Copy here:
Baidu NetDriver Link: 百度网盘 请输入提取码
Code : ribc

Neither way, w/o SSL. In general, all UGC alike websites are blocked by the GFW.

In fact I’m using a VPN from Los Angeles, with access to Google, Twitter, etc. But it just somehow filed connecting to box.com.
It would be so nice of you if you could down the wheel for python2 and upload to baidu driver.
Big thanks.

Hi, After I installed the PyTorch wheel for Python3, this is what I got. ( I am using Nano, and just flash it)

~$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import numpy
import torch
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python3.6/dist-packages/torch/init.py”, line 79, in
from torch._C import *
ImportError: /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch_python.so: undefined symbol: _Py_ZeroStruct

Could you tell me is there other packages that I need to install?

Thank you

Torch wheel for Python2.7 @Baidu NetDriver:

Code: j2eq
MD5 (torch-1.1.0a0+b457266-cp27-cp27mu-linux_aarch64.whl) = 6515e05c0eb1437ca9fa187391df7505

For those behind the GFW who can’t download the wheel from box.com, please use the following Baidu NetDriver Linker:

PyTorch for Python 2.7

Code: j2eq
MD5 (torch-1.1.0a0+b457266-cp27-cp27mu-linux_aarch64.whl) = 6515e05c0eb1437ca9fa187391df7505

PyTorch for Python 3.6

Code : ribc
MD5 (torch-1.1.0a0+b457266-cp36-cp36m-linux_aarch64.whl) = a08c545c05651e6a9651010c13f3151f

Happy hacking :)

As advised, I reflashed the Xavier with Jetpack 4.2. But it still is not working.
I created a new virutal environment using virtual-env and installed the pre-built wheel for python 3 specified in the top post.

>>> import torch
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/nvidia/python3/lib/python3.6/site-packages/torch/__init__.py", line 97, in <module>
        from torch._C import *
ImportError: numpy.core.multiarray failed to import
1 Like