Skip to content

Instantly share code, notes, and snippets.

@dusty-nv
Last active October 21, 2021 01:28
Show Gist options
  • Star 85 You must be signed in to star a gist
  • Fork 24 You must be signed in to fork a gist
  • Save dusty-nv/ef2b372301c00c0a9d3203e42fd83426 to your computer and use it in GitHub Desktop.
Save dusty-nv/ef2b372301c00c0a9d3203e42fd83426 to your computer and use it in GitHub Desktop.
Install procedure for pyTorch on NVIDIA Jetson TX1/TX2 with JetPack <= 3.2.1. For JetPack 4.2 and Xavier/Nano/TX2, see https://devtalk.nvidia.com/default/topic/1049071/jetson-nano/pytorch-for-jetson-nano/
#!/bin/bash
#
# EDIT: this script is outdated, please see https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-6-0-now-available
#
sudo apt-get install python-pip
# upgrade pip
pip install -U pip
pip --version
# pip 9.0.1 from /home/ubuntu/.local/lib/python2.7/site-packages (python 2.7)
# clone pyTorch repo
git clone http://github.com/pytorch/pytorch
cd pytorch
git submodule update --init
# install prereqs
sudo pip install -U setuptools
sudo pip install -r requirements.txt
# Develop Mode:
python setup.py build_deps
sudo python setup.py develop
# Install Mode: (substitute for Develop Mode commands)
#sudo python setup.py install
# Verify CUDA (from python interactive terminal)
# import torch
# print(torch.__version__)
# print(torch.cuda.is_available())
# a = torch.cuda.FloatTensor(2)
# print(a)
# b = torch.randn(2).cuda()
# print(b)
# c = a + b
# print(c)
@attiladoor
Copy link

attiladoor commented Nov 22, 2019

Hi,
I am trying to install pytorch v1 on TX2 with Jetpack 3.3 and I m getting the following error after running the command $ python setup.py install:
....
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '6']' returned non-zero exit status 2
I also tried to run python setup.py build_deps but I am getting error: invalid command 'build_deps'

Do you know how could I solve it?

Thanks a lot!

I found the following comment in setup.py and it solved my issue (i had the same)

It is no longer necessary to use the 'build' or 'rebuild' targets

To install:
  $ python setup.py install
To develop locally:
  $ python setup.py develop
To force cmake to re-generate native build files (off by default):
  $ python setup.py develop --cmake

@dusty-nv
Copy link
Author

dusty-nv commented Nov 22, 2019 via email

@Bfzanchetta
Copy link

Hey @dusty-nv , it seems that the latest release of NCCL 2.6.4.1 recognizes ARM CPUs. I'm currently attempting to install it to my Jetson TX2, because I have been wanting this for some time. However, I must warn: some scripts from the master branch of nccl git are commited with messages from previous releases, which is a yellow flag. If I do get it, I intend to release all my configuration and installation scripts for the community. I'll let you know.

Have a good one.

@snowcrumble
Copy link

git submodule update --init --recursive

@pmushidi2
Copy link

Hi Everyone, I am having a similar issue and need some assistance. I am trying to install pytorch on the odroid board xu4 but I get the following error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’. Below is the error message directly from the terminal.
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x8c4-minmax-fp32-neondot.c: In function ‘xnn_qs8_gemm_minmax_fp32_ukernel_1x8c4__neondot’:
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x8c4-minmax-fp32-neondot.c:91:17: error: redefinition of ‘vproduct0x0123’
91 | float32x4_t vproduct0x0123 = vmulq_f32(vproduct0x0123, vscale);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x8c4-minmax-fp32-neondot.c:88:17: note: previous definition of ‘vproduct0x0123’ was here
88 | float32x4_t vproduct0x0123 = vcvtq_f32_s32(vacc0x0123);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x8c4-minmax-fp32-neondot.c:92:17: error: redefinition of ‘vproduct0x4567’
92 | float32x4_t vproduct0x4567 = vmulq_f32(vproduct0x4567, vscale);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x8c4-minmax-fp32-neondot.c:89:17: note: previous definition of ‘vproduct0x4567’ was here
89 | float32x4_t vproduct0x4567 = vcvtq_f32_s32(vacc0x4567);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x8c4-minmax-fp32-neondot.c:94:18: warning: implicit declaration of function ‘vcvtnq_s32_f32’; did you mean ‘vcvtq_s32_f32’? [-Wimplicit-function-declaration]
94 | vacc0x0123 = vcvtnq_s32_f32(vproduct0x0123);
| ^~~~~~~~~~~~~~
| vcvtq_s32_f32
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x8c4-minmax-fp32-neondot.c:94:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x8c4-minmax-fp32-neondot.c:95:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
95 | vacc0x4567 = vcvtnq_s32_f32(vproduct0x4567);
| ^~~~~~~~~~~~~~
[ 60%] Building C object confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c.o
make[2]: *** [confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/build.make:15598: confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/qs8-gemm/gen/1x8c4-minmax-fp32-neondot.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x16c4-minmax-fp32-neondot.c: In function ‘xnn_qs8_gemm_minmax_fp32_ukernel_1x16c4__neondot’:
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x16c4-minmax-fp32-neondot.c:112:18: warning: implicit declaration of function ‘vcvtnq_s32_f32’; did you mean ‘vcvtq_s32_f32’? [-Wimplicit-function-declaration]
112 | vacc0x0123 = vcvtnq_s32_f32(vproduct0x0123);
| ^~~~~~~~~~~~~~
| vcvtq_s32_f32
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x16c4-minmax-fp32-neondot.c:112:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x16c4-minmax-fp32-neondot.c:113:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
113 | vacc0x4567 = vcvtnq_s32_f32(vproduct0x4567);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x16c4-minmax-fp32-neondot.c:114:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
114 | vacc0x89AB = vcvtnq_s32_f32(vproduct0x89AB);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/1x16c4-minmax-fp32-neondot.c:115:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
115 | vacc0xCDEF = vcvtnq_s32_f32(vproduct0xCDEF);
| ^~~~~~~~~~~~~~
make[2]: *** [confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/build.make:15624: confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/qs8-gemm/gen/1x16c4-minmax-fp32-neondot.c.o] Error 1
/tmp/cc3aAMfl.s: Assembler messages:
/tmp/cc3aAMfl.s:73: Error: selected processor does not support vsdot.s8 q9,q10,d7[0]' in ARM mode /tmp/cc3aAMfl.s:76: Error: selected processor does not support vsdot.s8 q9,q10,d7[1]' in ARM mode
/tmp/cc3aAMfl.s:78: Error: selected processor does not support vsdot.s8 q8,q10,d7[0]' in ARM mode /tmp/cc3aAMfl.s:80: Error: selected processor does not support vsdot.s8 q8,q10,d7[1]' in ARM mode
/tmp/cc3aAMfl.s:152: Error: selected processor does not support vsdot.s8 q9,q10,d7[0]' in ARM mode /tmp/cc3aAMfl.s:154: Error: selected processor does not support vsdot.s8 q8,q10,d7[0]' in ARM mode
make[2]: *** [confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/build.make:15611: confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/qs8-gemm/gen/1x8c4-minmax-gemmlowp-neondot.c.o] Error 1
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c: In function ‘xnn_qs8_gemm_minmax_fp32_ukernel_4x8c4__neondot’:
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c:154:18: warning: implicit declaration of function ‘vcvtnq_s32_f32’; did you mean ‘vcvtq_s32_f32’? [-Wimplicit-function-declaration]
154 | vacc0x0123 = vcvtnq_s32_f32(vproduct0x0123);
| ^~~~~~~~~~~~~~
| vcvtq_s32_f32
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c:154:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c:155:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
155 | vacc0x4567 = vcvtnq_s32_f32(vproduct0x4567);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c:156:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
156 | vacc1x0123 = vcvtnq_s32_f32(vproduct1x0123);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c:157:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
157 | vacc1x4567 = vcvtnq_s32_f32(vproduct1x4567);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c:158:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
158 | vacc2x0123 = vcvtnq_s32_f32(vproduct2x0123);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c:159:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
159 | vacc2x4567 = vcvtnq_s32_f32(vproduct2x4567);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c:160:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
160 | vacc3x0123 = vcvtnq_s32_f32(vproduct3x0123);
| ^~~~~~~~~~~~~~
/home/odroid/pytorch_install/pytorch/third_party/XNNPACK/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c:161:18: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
161 | vacc3x4567 = vcvtnq_s32_f32(vproduct3x4567);
| ^~~~~~~~~~~~~~
make[2]: *** [confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/build.make:15650: confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/qs8-gemm/gen/4x8c4-minmax-fp32-neondot.c.o] Error 1
/tmp/ccB1jg1m.s: Assembler messages:
/tmp/ccB1jg1m.s:80: Error: selected processor does not support vsdot.s8 q12,q9,d7[0]' in ARM mode /tmp/ccB1jg1m.s:83: Error: selected processor does not support vsdot.s8 q12,q9,d7[1]' in ARM mode
/tmp/ccB1jg1m.s:86: Error: selected processor does not support vsdot.s8 q11,q9,d7[0]' in ARM mode /tmp/ccB1jg1m.s:89: Error: selected processor does not support vsdot.s8 q11,q9,d7[1]' in ARM mode
/tmp/ccB1jg1m.s:92: Error: selected processor does not support vsdot.s8 q10,q9,d7[0]' in ARM mode /tmp/ccB1jg1m.s:94: Error: selected processor does not support vsdot.s8 q10,q9,d7[1]' in ARM mode
/tmp/ccB1jg1m.s:96: Error: selected processor does not support vsdot.s8 q8,q9,d7[0]' in ARM mode /tmp/ccB1jg1m.s:98: Error: selected processor does not support vsdot.s8 q8,q9,d7[1]' in ARM mode
/tmp/ccB1jg1m.s:196: Error: selected processor does not support vsdot.s8 q12,q9,d7[0]' in ARM mode /tmp/ccB1jg1m.s:198: Error: selected processor does not support vsdot.s8 q10,q9,d7[0]' in ARM mode
/tmp/ccB1jg1m.s:200: Error: selected processor does not support vsdot.s8 q11,q9,d7[0]' in ARM mode /tmp/ccB1jg1m.s:202: Error: selected processor does not support vsdot.s8 q8,q9,d7[0]' in ARM mode
make[2]: *** [confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/build.make:15637: confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/qs8-gemm/gen/1x16c4-minmax-gemmlowp-neondot.c.o] Error 1
make[1]: *** [CMakeFil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment