I got a Jetson Orin Nano 8g,
installed torch(2.0.0+nv23.05) following the guide of nvidia,
installed torchvision 0.15.1 by pip (which was the reason I met the error)
and tried to run yolov5 on it, then the “c++ runtime error” of torchvision came up.
Solution research
The search results said that the prebuild pack from pypi didn’t work on jetson. so I tried installing from source, by running “sudo python3 setup.py install”.
Process
At the beginning, it couldn’t find ninja and ffmpeg(but the ffmpeg works by direct calling in terminal ).Here is a part of the warning message I have got during compiling:
/usr/local/lib/python3.8/dist-packages/torch/include/c10/util/irange.h(54): warning: pointless comparison of unsigned integer with zero
detected during:
instantiation of "__nv_bool c10::detail::integer_iterator<I, one_sided, <unnamed>>::operator==(const c10::detail::integer_iterator<I, one_sided, <unnamed>> &) const [with I=size_t, one_sided=false, <unnamed>=0]"
(61): here
instantiation of "__nv_bool c10::detail::integer_iterator<I, one_sided, <unnamed>>::operator!=(const c10::detail::integer_iterator<I, one_sided, <unnamed>> &) const [with I=size_t, one_sided=false, <unnamed>=0]"
/usr/local/lib/python3.8/dist-packages/torch/include/c10/core/TensorImpl.h(77): here
/usr/local/lib/python3.8/dist-packages/torch/include/c10/util/irange.h(54): warning: pointless comparison of unsigned integer with zero
detected during:
instantiation of "__nv_bool c10::detail::integer_iterator<I, one_sided, <unnamed>>::operator==(const c10::detail::integer_iterator<I, one_sided, <unnamed>> &) const [with I=std::size_t, one_sided=true, <unnamed>=0]"
(61): here
instantiation of "__nv_bool c10::detail::integer_iterator<I, one_sided, <unnamed>>::operator!=(const c10::detail::integer_iterator<I, one_sided, <unnamed>> &) const [with I=std::size_t, one_sided=true, <unnamed>=0]"
/usr/local/lib/python3.8/dist-packages/torch/include/ATen/core/qualified_name.h(73): here
/usr/local/lib/python3.8/dist-packages/torch/include/c10/util/C++17.h(385): warning: missing return statement at end of non-void function "c10::guts::if_constexpr<Condition,ThenCallback,ElseCallback>(ThenCallback &&, ElseCallback &&) [with Condition=true, ThenCallback=lambda []()->void (*)(torch::Library &), ElseCallback=lambda []()->lambda [](torch::Library &)->void]"
detected during instantiation of "decltype(auto) c10::guts::if_constexpr<Condition,ThenCallback,ElseCallback>(ThenCallback &&, ElseCallback &&) [with Condition=true, ThenCallback=lambda []()->void (*)(torch::Library &), ElseCallback=lambda []()->lambda [](torch::Library &)->void]"
/home/mic-711on/temp/vision-0.15.1/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu(1314): here
/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/mic-711on/temp/vision-0.15.1/torchvision/csrc -I/usr/local/lib/python3.8/dist-packages/torch/include -I/usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.8/dist-packages/torch/include/TH -I/usr/local/lib/python3.8/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.8 -c /home/mic-711on/temp/vision-0.15.1/torchvision/csrc/ops/cuda/nms_kernel.cu -o build/temp.linux-aarch64-cpython-38/home/mic-711on/temp/vision-0.15.1/torchvision/csrc/ops/cuda/nms_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1013\" -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=1 -gencode=arch=compute_87,code=compute_87 -gencode=arch=compute_87,code=sm_87 -std=c++17
/home/mic-711on/temp/vision-0.15.1/torchvision/csrc/ops/cuda/nms_kernel.cu(106): warning: variable "device_guard" was declared but never referenced
/usr/local/lib/python3.8/dist-packages/torch/include/c10/util/C++17.h(385): warning: missing return statement at end of non-void function "c10::guts::if_constexpr<Condition,ThenCallback,ElseCallback>(ThenCallback &&, ElseCallback &&) [with Condition=true, ThenCallback=lambda []()->void (*)(torch::Library &), ElseCallback=lambda []()->lambda [](torch::Library &)->void]"
detected during instantiation of "decltype(auto) c10::guts::if_constexpr<Condition,ThenCallback,ElseCallback>(ThenCallback &&, ElseCallback &&) [with Condition=true, ThenCallback=lambda []()->void (*)(torch::Library &), ElseCallback=lambda []()->lambda [](torch::Library &)->void]"
/home/mic-711on/temp/vision-0.15.1/torchvision/csrc/ops/cuda/nms_kernel.cu(169): here
/usr/local/lib/python3.8/dist-packages/torch/include/c10/util/irange.h(54): warning: pointless comparison of unsigned integer with zero
detected during:
instantiation of "__nv_bool c10::detail::integer_iterator<I, one_sided, <unnamed>>::operator==(const c10::detail::integer_iterator<I, one_sided, <unnamed>> &) const [with I=size_t, one_sided=false, <unnamed>=0]"
(61): here
instantiation of "__nv_bool c10::detail::integer_iterator<I, one_sided, <unnamed>>::operator!=(const c10::detail::integer_iterator<I, one_sided, <unnamed>> &) const [with I=size_t, one_sided=false, <unnamed>=0]"
/usr/local/lib/python3.8/dist-packages/torch/include/c10/core/TensorImpl.h(77): here
/usr/local/lib/python3.8/dist-packages/torch/include/c10/util/irange.h(54): warning: pointless comparison of unsigned integer with zero
detected during:
instantiation of "__nv_bool c10::detail::integer_iterator<I, one_sided, <unnamed>>::operator==(const c10::detail::integer_iterator<I, one_sided, <unnamed>> &) const [with I=std::size_t, one_sided=true, <unnamed>=0]"
(61): here
instantiation of "__nv_bool c10::detail::integer_iterator<I, one_sided, <unnamed>>::operator!=(const c10::detail::integer_iterator<I, one_sided, <unnamed>> &) const [with I=std::size_t, one_sided=true, <unnamed>=0]"
/usr/local/lib/python3.8/dist-packages/torch/include/ATen/core/qualified_name.h(73): here
/usr/local/lib/python3.8/dist-packages/torch/include/c10/util/C++17.h(385): warning: missing return statement at end of non-void function "c10::guts::if_constexpr<Condition,ThenCallback,ElseCallback>(ThenCallback &&, ElseCallback &&) [with Condition=true, ThenCallback=lambda []()->void (*)(torch::Library &), ElseCallback=lambda []()->lambda [](torch::Library &)->void]"
detected during instantiation of "decltype(auto) c10::guts::if_constexpr<Condition,ThenCallback,ElseCallback>(ThenCallback &&, ElseCallback &&) [with Condition=true, ThenCallback=lambda []()->void (*)(torch::Library &), ElseCallback=lambda []()->lambda [](torch::Library &)->void]"
/home/mic-711on/temp/vision-0.15.1/torchvision/csrc/ops/cuda/nms_kernel.cu(169): here
/home/mic-711on/temp/vision-0.15.1/torchvision/csrc/ops/cuda/ps_roi_align_kernel.cu(317): warning: variable "device_guard" was declared but never referenced
and the end of the installation is
Using /usr/local/lib/python3.8/dist-packages
Finished processing dependencies for torchvision==0.15.1a0
After that :
- I could not find the packages dir in python3.8/dist-packages , but there is a torchvision-xxxx.egg( a directory).
- I could not find torchvision in pip3 list.
- I could not import torchvision in terminal with python3.8 or pycharm.
Environment:
Despite the torchvision doesn’t work, the pytorch(2.0.0+nv23.05) is fine, the cuda.is_available return ‘True’.
I didn’t do any installation with virtual environment since this machine is a sample, and the manufacturer told me “everything including cuda is install without virtual enviroment”.
This machine has 3 different version of python(2.7, 3.8, 3.9), but I am pretty sure that all the process involved only used the python 3.8.
The jatpack version might be 5.1.1(told by the manufacturer), the ‘sudo apt-cache’ command doesn’t work on my model.
So how can I fix this?