本文主要是介绍UserWarning: Failed to load image Python extension: warn(f“Failed to load image Python extension: {e,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
TensorRT INT8 calibration python API - Jetson & Embedded Systems / Jetson AGX Orin - NVIDIA Developer Forums 原因可能是从yolo5内文件requirements.txt下载的下载的并且无法支持nvidia定制的gpu
pip3 install -r requirements.txt
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/matplotlib/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/matplotlib/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff7dcf60d0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/matplotlib/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff7dcf6970>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/matplotlib/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff7dcf6ca0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/matplotlib/
ERROR: Could not find a version that satisfies the requirement matplotlib>=3.2.2 (from -r requirements.txt (line 4)) (from versions: none)
ERROR: No matching distribution found for matplotlib>=3.2.2 (from -r requirements.txt (line 4))
nvidia@1:~/yolov5$ pip3 install -r requirements.txt
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff828b0220>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/matplotlib/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff828b07c0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/matplotlib/
Collecting matplotlib>=3.2.2Using cached matplotlib-3.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (11.6 MB)
Collecting numpy>=1.18.5Using cached numpy-1.23.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.0 MB)
Collecting opencv-python>=4.1.2Using cached opencv_python-4.6.0.66-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (39.5 MB)
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (from -r requirements.txt (line 7)) (7.0.0)
Requirement already satisfied: PyYAML>=5.3.1 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 8)) (5.3.1)
Collecting scipy>=1.4.1Using cached scipy-1.9.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (30.4 MB)
Collecting torch>=1.7.0Downloading torch-1.12.1-cp38-cp38-manylinux2014_aarch64.whl (55.7 MB)|████████████████████████████████| 55.7 MB 339 kB/s
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/torchvision/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff819a6a00>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/torchvision/
Collecting torchvision>=0.8.1Downloading torchvision-0.13.1-cp38-cp38-manylinux2014_aarch64.whl (701 kB)|████████████████████████████████| 701 kB 301 kB/s
Collecting tqdm>=4.41.0Downloading tqdm-4.64.1-py2.py3-none-any.whl (78 kB)|████████████████████████████████| 78 kB 313 kB/s
Collecting tensorboard>=2.4.1Downloading tensorboard-2.10.1-py3-none-any.whl (5.9 MB)|████████████████████████████████| 5.9 MB 244 kB/s
Collecting seaborn>=0.11.0Downloading seaborn-0.12.1-py3-none-any.whl (288 kB)|████████████████████████████████| 288 kB 75 kB/s
Requirement already satisfied: pandas in /usr/lib/python3/dist-packages (from -r requirements.txt (line 20)) (0.25.3)
Collecting thopDownloading thop-0.1.1.post2209072238-py3-none-any.whl (15 kB)
Collecting pycocotools>=2.0Downloading pycocotools-2.0.5.tar.gz (24 kB)Installing build dependencies ... doneGetting requirements to build wheel ... donePreparing wheel metadata ... done
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/lib/python3/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (1.0.1)
Collecting fonttools>=4.22.0Downloading fonttools-4.38.0-py3-none-any.whl (965 kB)|████████████████████████████████| 965 kB 389 kB/s
Collecting packaging>=20.0Downloading packaging-21.3-py3-none-any.whl (40 kB)|████████████████████████████████| 40 kB 337 kB/s
Requirement already satisfied: python-dateutil>=2.7 in /usr/lib/python3/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (2.7.3)
Collecting contourpy>=1.0.1Downloading contourpy-1.0.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (278 kB)|████████████████████████████████| 278 kB 502 kB/s
Requirement already satisfied: pyparsing>=2.2.1 in /usr/lib/python3/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (2.4.6)
Requirement already satisfied: cycler>=0.10 in /usr/lib/python3/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (0.10.0)
Collecting typing-extensionsDownloading typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from torchvision>=0.8.1->-r requirements.txt (line 11)) (2.22.0)
Collecting markdown>=2.6.8Downloading Markdown-3.4.1-py3-none-any.whl (93 kB)|████████████████████████████████| 93 kB 176 kB/s
Collecting protobuf<3.20,>=3.9.2Downloading protobuf-3.19.6-cp38-cp38-manylinux2014_aarch64.whl (913 kB)|████████████████████████████████| 913 kB 858 kB/s
Requirement already satisfied: setuptools>=41.0.0 in /usr/lib/python3/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (45.2.0)
Requirement already satisfied: wheel>=0.26 in /usr/lib/python3/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (0.34.2)
Collecting grpcio>=1.24.3Downloading grpcio-1.50.0.tar.gz (22.1 MB)|████████████████████████████████| 22.1 MB 216 kB/s
Collecting google-auth-oauthlib<0.5,>=0.4.1Downloading google_auth_oauthlib-0.4.6-py2.py3-none-any.whl (18 kB)
Collecting tensorboard-data-server<0.7.0,>=0.6.0Downloading tensorboard_data_server-0.6.1-py3-none-any.whl (2.4 kB)
Collecting absl-py>=0.4Downloading absl_py-1.3.0-py3-none-any.whl (124 kB)|████████████████████████████████| 124 kB 225 kB/s
Collecting tensorboard-plugin-wit>=1.6.0Downloading tensorboard_plugin_wit-1.8.1-py3-none-any.whl (781 kB)|████████████████████████████████| 781 kB 299 kB/s
Collecting werkzeug>=1.0.1Downloading Werkzeug-2.2.2-py3-none-any.whl (232 kB)|████████████████████████████████| 232 kB 255 kB/s
Collecting google-auth<3,>=1.6.3Downloading google_auth-2.13.0-py2.py3-none-any.whl (174 kB)|████████████████████████████████| 174 kB 247 kB/s
Collecting importlib-metadata>=4.4; python_version < "3.10"Downloading importlib_metadata-5.0.0-py3-none-any.whl (21 kB)
Requirement already satisfied: six>=1.5.2 in /usr/lib/python3/dist-packages (from grpcio>=1.24.3->tensorboard>=2.4.1->-r requirements.txt (line 15)) (1.14.0)
Collecting requests-oauthlib>=0.7.0Downloading requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting MarkupSafe>=2.1.1Downloading MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (26 kB)
Collecting rsa<5,>=3.1.4; python_version >= "3.6"Downloading rsa-4.9-py3-none-any.whl (34 kB)
Collecting pyasn1-modules>=0.2.1Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)|████████████████████████████████| 155 kB 230 kB/s
Collecting cachetools<6.0,>=2.0.0Downloading cachetools-5.2.0-py3-none-any.whl (9.3 kB)
Collecting zipp>=0.5Downloading zipp-3.10.0-py3-none-any.whl (6.2 kB)
Requirement already satisfied: oauthlib>=3.0.0 in /usr/lib/python3/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.4.1->-r requirements.txt (line 15)) (3.1.0)
Collecting pyasn1>=0.1.3Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)|████████████████████████████████| 77 kB 250 kB/s
Building wheels for collected packages: pycocotools, grpcioBuilding wheel for pycocotools (PEP 517) ... doneCreated wheel for pycocotools: filename=pycocotools-2.0.5-cp38-cp38-linux_aarch64.whl size=411086 sha256=9258eeb5a09c4c4984f774af0c664b656a3368666bfb4a735c07d41d77754cb9Stored in directory: /home/nvidia/.cache/pip/wheels/88/17/cf/70d56b589c12b80ea6cc98f3aba11eea103993b660198788c0Building wheel for grpcio (setup.py) ... doneCreated wheel for grpcio: filename=grpcio-1.50.0-cp38-cp38-linux_aarch64.whl size=74598907 sha256=e7109a118f15214d2d105aac40df1ff75bb8af193e16da565232fcd3d3669032Stored in directory: /home/nvidia/.cache/pip/wheels/0a/ff/10/ada608f07eb40b11b6a81f660480ea542fae8cce6a20aca14d
Successfully built pycocotools grpcio
ERROR: seaborn 0.12.1 has requirement matplotlib!=3.6.1,>=3.1, but you'll have matplotlib 3.6.1 which is incompatible.
Installing collected packages: fonttools, packaging, numpy, contourpy, matplotlib, opencv-python, scipy, typing-extensions, torch, torchvision, tqdm, zipp, importlib-metadata, markdown, protobuf, grpcio, pyasn1, rsa, pyasn1-modules, cachetools, google-auth, requests-oauthlib, google-auth-oauthlib, tensorboard-data-server, absl-py, tensorboard-plugin-wit, MarkupSafe, werkzeug, tensorboard, seaborn, thop, pycocotoolsWARNING: The scripts fonttools, pyftmerge, pyftsubset and ttx are installed in '/home/nvidia/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.WARNING: The scripts f2py, f2py3 and f2py3.8 are installed in '/home/nvidia/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.WARNING: The scripts convert-caffe2-to-onnx, convert-onnx-to-caffe2 and torchrun are installed in '/home/nvidia/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.WARNING: The script tqdm is installed in '/home/nvidia/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.WARNING: The script markdown_py is installed in '/home/nvidia/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.WARNING: The scripts pyrsa-decrypt, pyrsa-encrypt, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in '/home/nvidia/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.WARNING: The script google-oauthlib-tool is installed in '/home/nvidia/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.WARNING: The script tensorboard is installed in '/home/nvidia/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed MarkupSafe-2.1.1 absl-py-1.3.0 cachetools-5.2.0 contourpy-1.0.5 fonttools-4.38.0 google-auth-2.13.0 google-auth-oauthlib-0.4.6 grpcio-1.50.0 importlib-metadata-5.0.0 markdown-3.4.1 matplotlib-3.6.1 numpy-1.23.4 opencv-python-4.6.0.66 packaging-21.3 protobuf-3.19.6 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycocotools-2.0.5 requests-oauthlib-1.3.1 rsa-4.9 scipy-1.9.3 seaborn-0.12.1 tensorboard-2.10.1 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 thop-0.1.1.post2209072238 torch-1.12.1 torchvision-0.13.1 tqdm-4.64.1 typing-extensions-4.4.0 werkzeug-2.2.2 zipp-3.10.0
nvidia@1:~/yolov5$ python
Python 2.7.18 (default, Jul 1 2022, 12:27:04)
[GCC 9.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>>
nvidia@1:~/yolov5$ python3
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torchvision
/home/nvidia/.local/lib/python3.8/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension:warn(f"Failed to load image Python extension: {e}")
>>>
使用的硬件jetson Agx orin
软件版本设置Bsp35.1 jetpack5.0.2
python3
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
im>>> import torchvision
/home/nvidia/.local/lib/python3.8/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension:warn(f"Failed to load image Python extension: {e}")
>>>
KeyboardInterrupt
>>>
nvidia@1:~$ pip3 uninstall -r requirements.txt
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
nvidia@1:~$ cd yolov5/
nvidia@1:~/yolov5$ pip3 uninstall -r requirements.txt
Found existing installation: matplotlib 3.6.1
Uninstalling matplotlib-3.6.1:Would remove:/home/nvidia/.local/lib/python3.8/site-packages/matplotlib-3.6.1-py3.8-nspkg.pth/home/nvidia/.local/lib/python3.8/site-packages/matplotlib-3.6.1.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/matplotlib/*/home/nvidia/.local/lib/python3.8/site-packages/mpl_toolkits/axes_grid1/*/home/nvidia/.local/lib/python3.8/site-packages/mpl_toolkits/axisartist/*/home/nvidia/.local/lib/python3.8/site-packages/mpl_toolkits/mplot3d/*/home/nvidia/.local/lib/python3.8/site-packages/mpl_toolkits/tests/*/home/nvidia/.local/lib/python3.8/site-packages/pylab.py
Proceed (y/n)? ySuccessfully uninstalled matplotlib-3.6.1
Found existing installation: numpy 1.23.4
Uninstalling numpy-1.23.4:Would remove:/home/nvidia/.local/bin/f2py/home/nvidia/.local/bin/f2py3/home/nvidia/.local/bin/f2py3.8/home/nvidia/.local/lib/python3.8/site-packages/numpy-1.23.4.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/numpy.libs/libgfortran-daac5196.so.5.0.0/home/nvidia/.local/lib/python3.8/site-packages/numpy.libs/libopenblas64_p-r0-9c1f2efe.3.20.so/home/nvidia/.local/lib/python3.8/site-packages/numpy/*
Proceed (y/n)? ySuccessfully uninstalled numpy-1.23.4
Found existing installation: opencv-python 4.6.0.66
Uninstalling opencv-python-4.6.0.66:Would remove:/home/nvidia/.local/lib/python3.8/site-packages/cv2/*/home/nvidia/.local/lib/python3.8/site-packages/opencv_python-4.6.0.66.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libQt5Core-9e162752.so.5.15.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libQt5Gui-a45894d1.so.5.15.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libQt5Test-32fc1c2a.so.5.15.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libQt5Widgets-b1296c1e.so.5.15.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libQt5XcbQpa-1f123f0b.so.5.15.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libX11-xcb-8ab4be54.so.1.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libXau-21870672.so.6.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libavcodec-7132c92a.so.58.134.100/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libavformat-a93773b3.so.58.76.100/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libavutil-5f9c2f63.so.56.70.100/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libbz2-738ca772.so.1.0.6/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libcrypto-082cd0b0.so.1.1/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libgfortran-8634ef04.so.3.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libopenblas-r0-8966572e.3.3.so/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libpng16-955a5627.so.16.37.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libssl-f41de0ea.so.1.1/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libswresample-af40e436.so.3.9.100/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libswscale-e6d9d937.so.5.9.100/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libvpx-48959a05.so.7.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-icccm-05fb8c7f.so.4.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-image-75825d2e.so.0.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-keysyms-73cd270d.so.1.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-randr-e1606dfc.so.0.1.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-render-76b15fe5.so.0.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-render-util-486ef3ee.so.0.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-shape-e8fe4bc4.so.0.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-shm-cad72500.so.0.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-sync-dc271c48.so.1.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-util-c74d156a.so.1.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-xfixes-f4cf71d4.so.0.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-xinerama-6372573d.so.0.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxcb-xkb-e2f6f9de.so.1.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxkbcommon-e272a37d.so.0.0.0/home/nvidia/.local/lib/python3.8/site-packages/opencv_python.libs/libxkbcommon-x11-b76c7d31.so.0.0.0
Proceed (y/n)? ySuccessfully uninstalled opencv-python-4.6.0.66
Found existing installation: Pillow 7.0.0
Not uninstalling pillow at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'Pillow'. No files were found to uninstall.
Found existing installation: PyYAML 5.3.1
Not uninstalling pyyaml at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'PyYAML'. No files were found to uninstall.
Found existing installation: scipy 1.9.3
Uninstalling scipy-1.9.3:Would remove:/home/nvidia/.local/lib/python3.8/site-packages/scipy-1.9.3.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/scipy.libs/libgfortran-daac5196.so.5.0.0/home/nvidia/.local/lib/python3.8/site-packages/scipy.libs/libopenblasp-r0-dff490c2.3.18.so/home/nvidia/.local/lib/python3.8/site-packages/scipy/*
Proceed (y/n)? ySuccessfully uninstalled scipy-1.9.3
Found existing installation: torch 1.12.1
Uninstalling torch-1.12.1:Would remove:/home/nvidia/.local/bin/convert-caffe2-to-onnx/home/nvidia/.local/bin/convert-onnx-to-caffe2/home/nvidia/.local/bin/torchrun/home/nvidia/.local/lib/python3.8/site-packages/caffe2/*/home/nvidia/.local/lib/python3.8/site-packages/torch-1.12.1.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/torch/*/home/nvidia/.local/lib/python3.8/site-packages/torchgen/*
Proceed (y/n)? ySuccessfully uninstalled torch-1.12.1
Found existing installation: torchvision 0.13.1
Uninstalling torchvision-0.13.1:Would remove:/home/nvidia/.local/lib/python3.8/site-packages/torchvision-0.13.1.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/torchvision/*
Proceed (y/n)? ySuccessfully uninstalled torchvision-0.13.1
Found existing installation: tqdm 4.64.1
Uninstalling tqdm-4.64.1:Would remove:/home/nvidia/.local/bin/tqdm/home/nvidia/.local/lib/python3.8/site-packages/tqdm-4.64.1.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/tqdm/*
Proceed (y/n)? ySuccessfully uninstalled tqdm-4.64.1
Found existing installation: tensorboard 2.10.1
Uninstalling tensorboard-2.10.1:Would remove:/home/nvidia/.local/bin/tensorboard/home/nvidia/.local/lib/python3.8/site-packages/tensorboard-2.10.1.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/tensorboard/*
Proceed (y/n)? ySuccessfully uninstalled tensorboard-2.10.1
Found existing installation: seaborn 0.12.1
Uninstalling seaborn-0.12.1:Would remove:/home/nvidia/.local/lib/python3.8/site-packages/seaborn-0.12.1.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/seaborn/*
Proceed (y/n)? ySuccessfully uninstalled seaborn-0.12.1
Found existing installation: pandas 0.25.3
Not uninstalling pandas at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'pandas'. No files were found to uninstall.
Found existing installation: thop 0.1.1.post2209072238
Uninstalling thop-0.1.1.post2209072238:Would remove:/home/nvidia/.local/lib/python3.8/site-packages/thop-0.1.1.post2209072238.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/thop/*
Proceed (y/n)? ySuccessfully uninstalled thop-0.1.1.post2209072238
Found existing installation: pycocotools 2.0.5
Uninstalling pycocotools-2.0.5:Would remove:/home/nvidia/.local/lib/python3.8/site-packages/pycocotools-2.0.5.dist-info/*/home/nvidia/.local/lib/python3.8/site-packages/pycocotools/*
Proceed (y/n)? ySuccessfully uninstalled pycocotools-2.0.5
nvidia@1:~/yolov5$ python3
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'
巨龙/巨炬:具有强大GPU加速能力的蟒蛇中的张量和动态神经网络 (github.com)
割炬 — PyTorch 1.12 文档
生态系统生态系统|派托奇 (pytorch.org)
用户手册议会联盟的 PyTorch: 用户指南 — 面向 IPU 的 PyTorch: 用户指南 (graphcore.ai)
基于 vision/README.rst at main · pytorch/vision · GitHub
安装完成测试验证示例
import torch
import torchvision
print("torch_version:",torch.__version__)
print("cuda_version:",torch.version.cuda)
print("cudnn_version:",torch.backends.cudnn.version())
print("----------------------------------")
flag = torch.cuda.is_available()
print(flag)
# 查看显卡个数
print("device_count:",torch.cuda.device_count())
ngpu= 1
# Decide which device we want to run on
device = torch.device("cuda:0" if (torch.cuda.is_available() and ngpu > 0) else "cpu")
print(device)
print("device_name:",torch.cuda.get_device_name(0))
print(torch.rand(3,3).cuda())print('CUDA available: ' + str(torch.cuda.is_available()))
print('cuDNN version: ' + str(torch.backends.cudnn.version()))
a = torch.cuda.FloatTensor(2).zero_()
print('Tensor a = ' + str(a))
b = torch.randn(2).cuda()
print('Tensor b = ' + str(b))
c = a + b
print('Tensor c = ' + str(c))print(torchvision.__version__)
测试通过
python3 test.py
torch_version: 1.12.0a0+2c916ef.nv22.3
cuda_version: 11.4
cudnn_version: 8401
----------------------------------
True
device_count: 1
cuda:0
device_name: Orin
tensor([[3.2590e-01, 2.1040e-04, 5.4763e-01],[2.0938e-01, 9.2065e-01, 2.8752e-01],[4.7694e-02, 9.3931e-02, 2.3878e-01]], device='cuda:0')
CUDA available: True
cuDNN version: 8401
Tensor a = tensor([0., 0.], device='cuda:0')
Tensor b = tensor([0.5067, 1.2200], device='cuda:0')
Tensor c = tensor([0.5067, 1.2200], device='cuda:0')
0.13.0
这篇关于UserWarning: Failed to load image Python extension: warn(f“Failed to load image Python extension: {e的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!