PyTorch, Jetpack 3.3 and Python3.5 - install issues

I recently installed Jetpack 3.3 and I’m trying to install PyTorch. I noticed that NVIDIA has been nice enough to provide wheels for Python2.7 and Python3.6, but I’m stuck using Python3.5 because it’s the Python version that I have to work with on this project. I’m trying to install PyTorch from source but I seem to be having a lot of trouble with NCCL.

I’ve tried disabling NCCL wherever I could (CMakeLists.txt file and setup.py file) as many others have suggested. This is the output of my most recent failure.

[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_apply.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_conversion_dispatch.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_dtypes.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_flatten.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_layouts.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_list.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_new.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_numpy.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_types.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tuple_parser.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/cuda/Module.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/cuda/Storage.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/cuda/Stream.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/cuda/utils.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/cuda/comm.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/cuda/python_comm.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/cuda/serialization.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/nn/THCUNN.cpp.o
[ 99%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/distributed/Module.cpp.o
[100%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/distributed/c10d/init.cpp.o
[100%] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/distributed/c10d/ddp.cpp.o
In file included from /home/nvidia/pytorch/torch/csrc/distributed/c10d/ddp.cpp:6:0:
/home/nvidia/pytorch/torch/csrc/cuda/nccl.h:8:18: fatal error: nccl.h: No such file or directory
compilation terminated.
caffe2/torch/CMakeFiles/torch_python.dir/build.make:1867: recipe for target 'caffe2/torch/CMakeFiles/torch_python.dir/csrc/distributed/c10d/ddp.cpp.o' failed
make[2]: *** [caffe2/torch/CMakeFiles/torch_python.dir/csrc/distributed/c10d/ddp.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:8019: recipe for target 'caffe2/torch/CMakeFiles/torch_python.dir/all' failed
make[1]: *** [caffe2/torch/CMakeFiles/torch_python.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Failed to run 'bash ../tools/build_pytorch_libs.sh --use-cuda --use-nnpack --use-qnnpack caffe2'

I’ve installed all the necessary requirements using pip3 and my basic approach is similar to this script from Dustin: https://gist.github.com/dusty-nv/ef2b372301c00c0a9d3203e42fd83426 with obvious redirections to python3 and pip3 wherever necessary.

In short: Is there an easy way to install PyTorch with Jetpack3.3 and Python3.5? I’ve had way more success in the past with Jetpack3.1.

Best regards,
Shreyas

Hi,

Could you try if this comment helps?
https://devtalk.nvidia.com/default/topic/1042821/jetson-tx2/pytorch-install-with-python3-broken/post/5290956/#5290956

Thanks.

Thanks for the quick response. Sadly I already tried this and it didn’t help.

After much fidgeting, it seems to work now. I will make a follow-up post with details on how if anyone requires.

Hi, singularity7

Some user also want to build pyTorch from source on TX2.
Would you mind to share your experience with us?

Thanks.

Hi,

I have the scripts in the following respository:

Feel free to pass that along and recommend that the user raise a github issue request if something isn’t working and I’ll try to address it.

Thanks!

1 Like

Hi singularity

Thanks will try this…

sojohans