Issues with installing torchvision 0.13.0

I’m currently following the guide on PyTorch for Jetson
and have installed pytorch 1.12.0 and python 3,8. However, when i tried to install torchvision v0.13.0 from using git clone and using python setup.py install --user, i get this issue

[11/16] c++ -MMD -MF /mnt/ssd1/home/brushlessdc/torchvision/build/temp.linux-aarch64-cpython-38/mnt/ssd1/home/brushlessdc/torchvision/torchvision/csrc/io/decoder/decoder.o.d -pthread -B /mnt/ssd1/home/brushlessdc/anaconda3/compiler_compat -Wl,–sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/mnt/ssd1/home/brushlessdc/torchvision/torchvision/csrc/io/decoder -I/mnt/ssd1/home/brushlessdc/torchvision/torchvision/csrc/io/video_reader -I/mnt/ssd1/home/brushlessdc/torchvision/torchvision/csrc/io/video -I/mnt/ssd1/home/brushlessdc/torchvision/torchvision/csrc -I/mnt/ssd1/home/brushlessdc/anaconda3/include -I/mnt/ssd1/home/brushlessdc/anaconda3/include/aarch64-linux-gnu -I/mnt/ssd1/home/brushlessdc/torchvision/torchvision/csrc -I/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/include -I/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/include/TH -I/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda/include -I/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/include -I/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/include/TH -I/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/include/THC -I/mnt/ssd1/home/brushlessdc/anaconda3/include/python3.8 -c -c /mnt/ssd1/home/brushlessdc/torchvision/torchvision/csrc/io/decoder/decoder.cpp -o /mnt/ssd1/home/brushlessdc/torchvision/build/temp.linux-aarch64-cpython-38/mnt/ssd1/home/brushlessdc/torchvision/torchvision/csrc/io/decoder/decoder.o -std=c++14 -DTORCH_API_INCLUDE_EXTENSION_H ‘-DPYBIND11_COMPILER_TYPE=“_gcc”’ ‘-DPYBIND11_STDLIB=“_libstdcpp”’ ‘-DPYBIND11_BUILD_ABI=“_cxxabi1013”’ -DTORCH_EXTENSION_NAME=video_reader -D_GLIBCXX_USE_CXX11_ABI=1
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 1726, in _run_ninja_build
subprocess.run(
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/subprocess.py”, line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command ‘[‘ninja’, ‘-v’]’ returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “setup.py”, line 514, in
setup(
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/init.py”, line 117, in setup
return distutils.core.setup(**attrs)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/core.py”, line 183, in setup
return run_commands(dist)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/core.py”, line 199, in run_commands
dist.run_commands()
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 954, in run_commands
self.run_command(cmd)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/dist.py”, line 950, in run_command
super().run_command(command)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 973, in run_command
cmd_obj.run()
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/install.py”, line 97, in run
self.do_egg_install()
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/install.py”, line 149, in do_egg_install
self.run_command(‘bdist_egg’)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/cmd.py”, line 316, in run_command
self.distribution.run_command(command)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/dist.py”, line 950, in run_command
super().run_command(command)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 973, in run_command
cmd_obj.run()
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/bdist_egg.py”, line 168, in run
cmd = self.call_command(‘install_lib’, warn_dir=False)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/bdist_egg.py”, line 154, in call_command
self.run_command(cmdname)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/cmd.py”, line 316, in run_command
self.distribution.run_command(command)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/dist.py”, line 950, in run_command
super().run_command(command)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 973, in run_command
cmd_obj.run()
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/install_lib.py”, line 19, in run
self.build()
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/command/install_lib.py”, line 110, in build
self.run_command(‘build_ext’)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/cmd.py”, line 316, in run_command
self.distribution.run_command(command)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/dist.py”, line 950, in run_command
super().run_command(command)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 973, in run_command
cmd_obj.run()
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/build_ext.py”, line 98, in run
_build_ext.run(self)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py”, line 186, in run
_build_ext.build_ext.run(self)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py”, line 359, in run
self.build_extensions()
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 741, in build_extensions
build_ext.build_extensions(self)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py”, line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py”, line 476, in build_extensions
self._build_extensions_serial()
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py”, line 502, in _build_extensions_serial
self.build_extension(ext)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/build_ext.py”, line 263, in build_extension
_build_ext.build_extension(self, ext)
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py”, line 557, in build_extension
objects = self.compiler.compile(
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 562, in unix_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 1405, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File “/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 1742, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

Hi,
Here are some suggestions for the common issues:

1. Performance

Please run the below command before benchmarking deep learning use case:

$ sudo nvpmodel -m 0
$ sudo jetson_clocks

2. Installation

Installation guide of deep learning frameworks on Jetson:

3. Tutorial

Startup deep learning tutorial:

4. Report issue

If these suggestions don’t help and you want to report an issue to us, please attach the model, command/step, and the customized app (if any) with us to reproduce locally.

Thanks!

I have followed the installation guide and ran both nvpmodel and jetson_clocks, installed https://developer.download.nvidia.com/compute/redist/jp/v502/pytorch/torch-1.13.0a0+d0d6b1f2.nv22.10-cp38-cp38-linux_aarch64.whl
but still unable to install torchvision v0.13.0 and v0.14.0, same error occurs.
Is it because I am currently using seeed studio’s NVIDIA® Jetson AGX Orin 32GB H01 Kit instead of Jetson AGX Orin Devkit

Hi,

Could you double-check the PyTorch version in the environment?

$ python
# import torch
# torch.__version__

Thanks.

Currently i went back to torch 0.12.0 since my program requires that, when i go

$ python
# import torch
# torch.__version__

it prints 1.12.0a0+8a1a93a9.nv22.5

Hi,

It looks like your PyTorch is correct (built with GPU support).
Could you share the command you used to build TorchVision?

So we can check if any issue with that?

Thanks.

Sure

$ sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libopenblas-dev libavcodec-dev libavformat-dev libswscale-dev
$ git clone --branch v0.13.0 https://github.com/pytorch/vision torchvision   # see below for version of torchvision to download
$ cd torchvision
$ export BUILD_VERSION=0.13.0  # where 0.x.0 is the torchvision version  
$ python3 setup.py install --user

Hello! Was there anything that I did wrong with my installation ?

Hi,

Could you try the below command to see if it works?

$ export CUDA_HOME=/usr/local/cuda

Then clean and restart the building:

$ python3 setup.py clean
$ python3 setup.py install --user

Thanks.

Thanks for the reply! However, i still get the same error after running setup.py install --user

After running

python3 setup.py clean

i get
setup.py:10: DeprecationWarning: pkg_resources is deprecated as an API. See Package Discovery and Resource Access using pkg_resources - setuptools 75.2.0.post20241022 documentation
from pkg_resources import parse_version, get_distribution, DistributionNotFound
Building wheel torchvision-0.13.0
PNG found: True
libpng version: 1.6.39
Building torchvision with PNG image support
libpng include path: /mnt/ssd1/home/brushlessdc/anaconda3/include/libpng16
Running build on conda-build: False
Running build on conda: True
JPEG found: True
Building torchvision with JPEG image support
NVJPEG found: False
FFmpeg found: True
ffmpeg include path: [‘/mnt/ssd1/home/brushlessdc/anaconda3/include’, ‘/mnt/ssd1/home/brushlessdc/anaconda3/include/aarch64-linux-gnu’]
ffmpeg library_dir: [‘/mnt/ssd1/home/brushlessdc/anaconda3/lib’, ‘/mnt/ssd1/home/brushlessdc/anaconda3/lib/aarch64-linux-gnu’]
video codec found: False
The installed version of ffmpeg is missing the header file ‘bsf.h’ which is required for GPU video decoding. Please install the latest ffmpeg from conda-forge channel: conda install -c conda-forge ffmpeg.
running clean

And after running ```
python3 setup.py install --user

i get
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1726, in _run_ninja_build
    subprocess.run(
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "setup.py", line 514, in <module>
    setup(
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/__init__.py", line 117, in setup
    return distutils.core.setup(**attrs)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 183, in setup
    return run_commands(dist)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 199, in run_commands
    dist.run_commands()
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
    self.run_command(cmd)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/dist.py", line 950, in run_command
    super().run_command(command)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
    cmd_obj.run()
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/install.py", line 97, in run
    self.do_egg_install()
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/install.py", line 149, in do_egg_install
    self.run_command('bdist_egg')
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
    self.distribution.run_command(command)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/dist.py", line 950, in run_command
    super().run_command(command)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
    cmd_obj.run()
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 168, in run
    cmd = self.call_command('install_lib', warn_dir=False)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 154, in call_command
    self.run_command(cmdname)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
    self.distribution.run_command(command)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/dist.py", line 950, in run_command
    super().run_command(command)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
    cmd_obj.run()
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/install_lib.py", line 19, in run
    self.build()
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/command/install_lib.py", line 110, in build
    self.run_command('build_ext')
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
    self.distribution.run_command(command)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/dist.py", line 950, in run_command
    super().run_command(command)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
    cmd_obj.run()
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 98, in run
    _build_ext.run(self)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
    self.build_extensions()
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 741, in build_extensions
    build_ext.build_extensions(self)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 476, in build_extensions
    self._build_extensions_serial()
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 502, in _build_extensions_serial
    self.build_extension(ext)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 263, in build_extension
    _build_ext.build_extension(self, ext)
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 557, in build_extension
    objects = self.compiler.compile(
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 562, in unix_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1405, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "/mnt/ssd1/home/brushlessdc/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1742, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

Hi,

Thanks for the testing.

Could you share how you installed PyTorch 1.12 on your environment?
Do you use the package that was downloaded from the same link?

Moreover, as you are using AGX Orin, it’s recommended to upgrade your environment to JetPack 6.
We have prebuilt PyTorch/TorchVision/TorchAudio for the JetPack 6 environment so you don’t do that manually.

Thanks.

Hi,

I installed Pytorch 1.12 with Deploy YOLOv8 with TensorRT and DeepStream SDK | Seeed Studio Wiki guide
No I did try with the link PyTorch for Jetson, but it was still the same result.

Hi,

Is JetPack 6.1 an option for you?
As we have provided the compatible PyTorch/TorchVision/TorchAudio in the below link:

http://jetson.webredirect.org/jp6/cu126

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.