Jetson 安装 torchvision 失败
问题描述
使用jetson设备 根据
NVIDIA Jetson - Ultralytics YOLO Docs
的步骤装上了pytorch 2.1.0,但是torchvision一直安装不上
sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libopenblas-dev libavcodec-dev libavformat-dev libswscale-dev
$ git clone --branch v0.16.1 https://github.com/pytorch/vision torchvision # see below for version of torchvision to download
$ cd torchvision
$ export BUILD_VERSION=0.16.1 # where 0.x.0 is the torchvision version
$ python3 setup.py install --user
(pytorch38) xavier@agxxavier:~/Downloads/torchvision/0.16.1/torchvision$ python3 setup.py install --user
执行以上指令时 提示以下错误:
简单来说报错信息是:
Please avoid running setup.py
directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
具体来说:
setup.py:10: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
from pkg_resources import DistributionNotFound, get_distribution, parse_version
Building wheel torchvision-0.16.1
Compiling extensions with following flags:
FORCE_CUDA: False
FORCE_MPS: False
DEBUG: False
TORCHVISION_USE_PNG: True
TORCHVISION_USE_JPEG: True
TORCHVISION_USE_NVJPEG: True
TORCHVISION_USE_FFMPEG: True
TORCHVISION_USE_VIDEO_CODEC: True
NVCC_FLAGS:
Compiling with debug mode OFF
Found PNG library
Building torchvision with PNG image support
libpng version: 1.6.37
libpng include path: /usr/include/libpng16
Running build on conda-build: False
Running build on conda: True
Building torchvision with JPEG image support
libjpeg include path: /home/xavier/miniconda3/envs/pytorch38/include
libjpeg lib path: /home/xavier/miniconda3/envs/pytorch38/lib
Building torchvision without NVJPEG image support
Building torchvision without ffmpeg support
Building torchvision without video codec support
running install
/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running setup.py
directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
Traceback (most recent call last):
File “setup.py”, line 542, in
setup(
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/init.py”, line 108, in setup
return distutils.core.setup(**attrs)
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/_distutils/core.py”, line 184, in setup
return run_commands(dist)
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/_distutils/core.py”, line 200, in run_commands
dist.run_commands()
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 970, in run_commands
self.run_command(cmd)
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/dist.py”, line 945, in run_command
super().run_command(command)
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 988, in run_command
cmd_obj.ensure_finalized()
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/_distutils/cmd.py”, line 111, in ensure_finalized
self.finalize_options()
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/command/install.py”, line 62, in finalize_options
super().finalize_options()
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/_distutils/command/install.py”, line 407, in finalize_options
‘dist_fullname’: self.distribution.get_fullname(),
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/_core_metadata.py”, line 266, in get_fullname
return _distribution_fullname(self.get_name(), self.get_version())
File “/home/xavier/miniconda3/envs/pytorch38/lib/python3.8/site-packages/setuptools/_core_metadata.py”, line 284, in _distribution_fullname
canonicalize_version(version, strip_trailing_zero=False),
TypeError: canonicalize_version() got an unexpected keyword argument ‘strip_trailing_zero’
解决方法
使用指令pip list 查看 setuptools的版本
如果大于60 则将pip的setuptools重新安装小于60的版本,解决了此问题。
pip install setuptools==58
设备信息
型号:Jetson AGX xavier
Software part of jetson-stats 4.2.8 - © 2024, Raffaello Bonghi
Model: Jetson AGX Xavier for DSBOARD-XV2 - Jetpack 5.1 [L4T 35.2.1]
NV Power Mode[0]: MAXN
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware:
- P-Number: p2888-0004
- Module: NVIDIA Jetson AGX Xavier (32 GB ram)
Platform: - Distribution: Ubuntu 20.04 focal
- Release: 5.10.104-tegra
jtop: - Version: 4.2.8
- Service: Active
Libraries: - CUDA: 11.4.315
- cuDNN: 8.6.0.166
- TensorRT: 8.5.2.2
- VPI: 2.2.4
- Vulkan: 1.3.204
- OpenCV: 4.5.4 - with CUDA: NO
参考链接
[2]: NVIDIA Jetson - Ultralytics YOLO Docs
[3]: http://t.csdnimg.cn/dEttQ