PyTorch for Jetson - version 1.7.0 now available

I have confirmed that the problem has been resolved in the new wheel. Thank you.

Hi @724773044, please use v0.8.1 as the branch to clone (including the v prefix before the version number)

Hi @zdary - did you end up getting this installed and working with python3.7? any advice here would be super appreciated, thanks!

Hi @SamuelWei - did you successfully build pytorch with python3.7? Any advice or help here would be greatly appreciated! Thank you!

I’ve got a Jetson Xavier NX running Jetpack 4.4. Release Version L4T32.4.3 which only works with PyTorch 1.6.0 or newer.

I need PyTorch 1.4.0 as I’m working with Python 2.7. (because of ROS) but I’m currently getting ImportError: ... when installing PyTorch v1.4.0. because my Jetson has CUDA 10.2. Should I downgrade my Jetson to Jetpack 4.4. Developer/Jetpack 4.3. to get rid of the compatibility errors or how should I proceed to get PyTorch 1.4.0 working?

Hi @jorgemia, if you absolutely need PyTorch 1.4 and Python 2.7, then yes downgrade to a previous JetPack version. PyTorch versions older than PyTorch 1.5 don’t support the production release of cuDNN 8.0.

An alterative would be to upgrade to a newer version of ROS that uses Python 3 (like ROS Noetic, or ROS2 Eloquent/Foxy). You can find the Dockerfiles for these newer versions of ROS here:

1 Like

Hello, I use Jetson TX2, and I have install the new Jetpack 4.4.1. and try install PyTorch v1.7.0.

But I have error when I run the last build using $ python3 bdist_wheel, after 49% building.

Does PyTorch v1.7.0 no need to do Apply Patch on this

Thank you very much.

Hi @anom.tmu, yes to build PyTorch 1.7.0 from source, it needs the patch applied (pytorch-1.7-jetpack-4.4.1.patch)

However, if you just install the pre-built wheel, you don’t need to build it from source.

JetPack 4.4 (L4T R32.4.3) / JetPack 4.4.1 (L4T R32.4.4)

Hi, I am trying to install pytorch v1.7.0 with torchvision v0.8.1 on Jetson AGX Xavier.

  1. JetPack4.4.1
  2. Cuda 10.2
  3. python 3.6.9

when I do

sudo python3 install

I get the following error:

/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/nvidia/torchvision/torchvision/csrc -I/home/nvidia/.local/lib/python3.6/site-packages/torch/include -I/home/nvidia/.local/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/nvidia/.local/lib/python3.6/site-packages/torch/include/TH -I/home/nvidia/.local/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c /home/nvidia/torchvision/torchvision/csrc/cuda/ -o build/temp.linux-aarch64-3.6/home/nvidia/torchvision/torchvision/csrc/cuda/PSROIAlign_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=1 -gencode=arch=compute_72,code=sm_72 -std=c++14
/usr/include/c++/8/utility(307): error: pack expansion does not make use of any argument packs

/usr/include/c++/8/utility(329): error: pack expansion does not make use of any argument packs

/usr/include/c++/8/utility(329): error: expected a ">"
          detected during instantiation of type "std::make_integer_sequence<std::size_t, _Num>"
(340): here

/usr/include/c++/8/utility(307): error: identifier "__integer_pack" is undefined
          detected during:
            instantiation of class "std::_Build_index_tuple<_Num> [with _Num=1UL]"
/usr/include/c++/8/functional(389): here
            instantiation of class "std::_Bind<_Functor (_Bound_args...)> [with _Functor=lambda [](std::function<c10::IValue ()>)->void, _Bound_args=<std::function<c10::IValue ()>>]"
/home/nvidia/.local/lib/python3.6/site-packages/torch/include/ATen/core/ivalue_inl.h(393): here

/usr/include/c++/8/utility(307): error: expected a ">"
          detected during:
            instantiation of class "std::_Build_index_tuple<_Num> [with _Num=1UL]"
/usr/include/c++/8/functional(389): here
            instantiation of class "std::_Bind<_Functor (_Bound_args...)> [with _Functor=lambda [](std::function<c10::IValue ()>)->void, _Bound_args=<std::function<c10::IValue ()>>]"
/home/nvidia/.local/lib/python3.6/site-packages/torch/include/ATen/core/ivalue_inl.h(393): here

/usr/include/c++/8/functional(482): error: no instance of function template "std::_Bind<_Functor (_Bound_args...)>::__call [with _Functor=lambda [](std::function<c10::IValue ()>)->void, _Bound_args=<std::function<c10::IValue ()>>]" matches the argument list
            argument types are: (std::tuple<>, <error-type>)
            object type is: std::_Bind<lambda [](std::function<c10::IValue ()>)->void (std::function<c10::IValue ()>)>
          detected during:
            instantiation of "_Result std::_Bind<_Functor (_Bound_args...)>::operator()(_Args &&...) [with _Functor=lambda [](std::function<c10::IValue ()>)->void, _Bound_args=<std::function<c10::IValue ()>>, _Args=<>, _Result=void]"
/usr/include/c++/8/bits/std_function.h(298): here
            instantiation of "void std::_Function_handler<void (_ArgTypes...), _Functor>::_M_invoke(const std::_Any_data &, _ArgTypes &&...) [with _Functor=std::_Bind<lambda [](std::function<c10::IValue ()>)->void (std::function<c10::IValue ()>)>, _ArgTypes=<>]"
/usr/include/c++/8/bits/std_function.h(675): here
            instantiation of "std::function<_Res (_ArgTypes...)>::function(_Functor) [with _Res=void, _ArgTypes=<>, _Functor=std::_Bind<lambda [](std::function<c10::IValue ()>)->void (std::function<c10::IValue ()>)>, <unnamed>=void, <unnamed>=void]"
/home/nvidia/.local/lib/python3.6/site-packages/torch/include/ATen/core/ivalue_inl.h(385): here

6 errors detected in the compilation of "/tmp/tmpxft_0000522e_00000000-6_PSROIAlign_cuda.cpp1.ii".
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1

Can anyone please help.

Hi @komalbagai123, I’m not familiar with this error, but have you tried installing the pre-built PyTorch 1.7 wheel without needing to build it from source yourself?

JetPack 4.4 (L4T R32.4.3) / JetPack 4.4.1 (L4T R32.4.4)

Regarding the compilation error, are you sure you cloned the PyTorch repo with --branch v1.7.0?

yes @dusty_nv, I have installed torch using the wheel itself. I can install and import torch on this easily but I am unable to install torchvision.