I tried to install torchvision , And I did the following:
1: jetson@jetson-desktop:~$ git clone --branch v0.16.1 git@github.com:pytorch/vision.git torchvision
2: jetson@jetson-desktop:~$ cd torchvision/
3: jetson@jetson-desktop:~/torchvision$ sudo apt-get install -y build-essential pkg-config yasm git
4: jetson@jetson-desktop:~/torchvision$ sudo apt-get install -y libavutil-dev libavcodec-dev libavformat-dev libswscale-dev libavfilter-dev libpostproc-dev
5: jetson@jetson-desktop:~/torchvision$ python3 setup.py install --user
1: Torch version: * JetPack 5.1 (L4T R35.2.1) / JetPack 5.1.1 (L4T R35.3.1) / JetPack 5.1.2 (L4T R35.4.1)
Python 3.8 - torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl
(2.1.0)
2: torchvision version: * PyTorch v2.1 - torchvision v0.16.1 (v0.16.1)
But I encountered the following issue:
28 | x.channels = y.channels;
| ^~~~~~~~
/home/jetson/torchvision/torchvision/csrc/io/decoder/audio_stream.cpp: In member function ‘virtual int ffmpeg::AudioStream::initFormat()’:
/home/jetson/torchvision/torchvision/csrc/io/decoder/audio_stream.cpp:58:48: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channels’
58 | format_.format.audio.channels = codecCtx_->channels;
| ^~~~~~~~
[4/16] c++ -MMD -MF /home/jetson/torchvision/build/temp.linux-aarch64-cpython-38/home/jetson/torchvision/torchvision/csrc/io/decoder/decoder.o.d -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/jetson/torchvision/torchvision/csrc/io/decoder -I/home/jetson/torchvision/torchvision/csrc/io/video_reader -I/home/jetson/torchvision/torchvision/csrc/io/video -I/home/jetson/torchvision/torchvision/csrc -I/usr/local/include -I/usr/local/include/aarch64-linux-gnu -I/home/jetson/torchvision/torchvision/csrc -I/home/jetson/.local/lib/python3.8/site-packages/torch/include -I/home/jetson/.local/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/jetson/.local/lib/python3.8/site-packages/torch/include/TH -I/home/jetson/.local/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda-11.4/include -I/home/jetson/.local/lib/python3.8/site-packages/torch/include -I/home/jetson/.local/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/jetson/.local/lib/python3.8/site-packages/torch/include/TH -I/home/jetson/.local/lib/python3.8/site-packages/torch/include/THC -I/usr/include/python3.8 -c -c /home/jetson/torchvision/torchvision/csrc/io/decoder/decoder.cpp -o /home/jetson/torchvision/build/temp.linux-aarch64-cpython-38/home/jetson/torchvision/torchvision/csrc/io/decoder/decoder.o -std=c++17 -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
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File “/home/jetson/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 1894, in _run_ninja_build
subprocess.run(
File “/usr/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 542, in
setup(
File “/usr/local/lib/python3.8/dist-packages/setuptools/init.py”, line 117, in setup
return distutils.core.setup(**attrs)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/core.py”, line 183, in setup
return run_commands(dist)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/core.py”, line 199, in run_commands
dist.run_commands()
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/dist.py”, line 954, in run_commands
self.run_command(cmd)
File “/usr/local/lib/python3.8/dist-packages/setuptools/dist.py”, line 999, in run_command
super().run_command(command)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/dist.py”, line 973, in run_command
cmd_obj.run()
File “/usr/local/lib/python3.8/dist-packages/setuptools/command/install.py”, line 96, in run
self.do_egg_install()
File “/usr/local/lib/python3.8/dist-packages/setuptools/command/install.py”, line 148, in do_egg_install
self.run_command(‘bdist_egg’)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/cmd.py”, line 316, in run_command
self.distribution.run_command(command)
File “/usr/local/lib/python3.8/dist-packages/setuptools/dist.py”, line 999, in run_command
super().run_command(command)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/dist.py”, line 973, in run_command
cmd_obj.run()
File “/usr/local/lib/python3.8/dist-packages/setuptools/command/bdist_egg.py”, line 177, in run
cmd = self.call_command(‘install_lib’, warn_dir=False)
File “/usr/local/lib/python3.8/dist-packages/setuptools/command/bdist_egg.py”, line 163, in call_command
self.run_command(cmdname)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/cmd.py”, line 316, in run_command
self.distribution.run_command(command)
File “/usr/local/lib/python3.8/dist-packages/setuptools/dist.py”, line 999, in run_command
super().run_command(command)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/dist.py”, line 973, in run_command
cmd_obj.run()
File “/usr/local/lib/python3.8/dist-packages/setuptools/command/install_lib.py”, line 19, in run
self.build()
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/command/install_lib.py”, line 110, in build
self.run_command(‘build_ext’)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/cmd.py”, line 316, in run_command
self.distribution.run_command(command)
File “/usr/local/lib/python3.8/dist-packages/setuptools/dist.py”, line 999, in run_command
super().run_command(command)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/dist.py”, line 973, in run_command
cmd_obj.run()
File “/usr/local/lib/python3.8/dist-packages/setuptools/command/build_ext.py”, line 98, in run
_build_ext.run(self)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/command/build_ext.py”, line 359, in run
self.build_extensions()
File “/home/jetson/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 846, in build_extensions
build_ext.build_extensions(self)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/command/build_ext.py”, line 476, in build_extensions
self._build_extensions_serial()
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/command/build_ext.py”, line 502, in _build_extensions_serial
self.build_extension(ext)
File “/usr/local/lib/python3.8/dist-packages/setuptools/command/build_ext.py”, line 263, in build_extension
_build_ext.build_extension(self, ext)
File “/home/jetson/.local/lib/python3.8/site-packages/Cython/Distutils/build_ext.py”, line 135, in build_extension
super(build_ext, self).build_extension(ext)
File “/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/command/build_ext.py”, line 557, in build_extension
objects = self.compiler.compile(
File “/home/jetson/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 659, in unix_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File “/home/jetson/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 1573, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File “/home/jetson/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 1910, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
jetson@jetson-desktop:~/torchvision$
Environment: