安装 torch-tensorrt 报错?

教程: https://pytorch.org/TensorRT/tutorials/installation.html

图片.png

╰─➤  pip install torch-tensorrt -f https://github.com/NVIDIA/Torch-TensorRT/releases 
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Looking in links: https://github.com/NVIDIA/Torch-TensorRT/releases
Collecting torch-tensorrt
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f3/5e/81c357454c59acedb1b83bfa1e2032f95bde827b5631bb695af6911f5a14/torch-tensorrt-0.0.0.post1.tar.gz (9.0 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-43y1ectf/torch-tensorrt_1366a8a2e4074e988cfb338889f6660c/setup.py", line 125, in <module>
          raise RuntimeError(open("ERROR.txt", "r").read())
      RuntimeError:
      ###########################################################################################
      The package you are trying to install is only a placeholder project on PyPI.org repository.
      To install Torch-TensorRT please run the following command:
      
      $ pip install torch-tensorrt -f https://github.com/NVIDIA/Torch-TensorRT/releases
      ###########################################################################################
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

环境是 pipenv 创建的 python3.10 虚拟环境

(image2vector) ╭─ponponon@M60GPU ~/code/image2vector  ‹master*› 
╰─➤  python --version                                                                                                                                                                                                                                                   1 ↵
Python 3.10.6
(image2vector) ╭─ponponon@M60GPU ~/code/image2vector  ‹master*› 
╰─➤  pip --version                                                                  
pip 23.0.1 from /home/ponponon/.local/share/virtualenvs/image2vector-oucNrpsS/lib/python3.10/site-packages/pip (python 3.10)

上传到 pypi 的 torch-tensorrt 是不可使用的

图片.png

我查了一下 pip 的 -f 参数的用法,说是先搜索 -f 指定的仓库,在使用默认的仓库

图片.png

所以,这个 pip 为什么不去 github 下载 torch-tensorrt,而是去了清华源呢?


问题和 pypi 源无关

换了几个源,也是没用

aliyun 不行

pip install torch-tensorrt -f https://github.com/NVIDIA/Torch-TensorRT/releases -i https://mirrors.aliyun.com/pypi/simple/                    1 ↵
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Looking in links: https://github.com/NVIDIA/Torch-TensorRT/releases
Collecting torch-tensorrt
  Downloading https://mirrors.aliyun.com/pypi/packages/f3/5e/81c357454c59acedb1b83bfa1e2032f95bde827b5631bb695af6911f5a14/torch-tensorrt-0.0.0.post1.tar.gz (9.0 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-h9ttq398/torch-tensorrt_dd19014765894c7781117b8cfe81726a/setup.py", line 125, in <module>
          raise RuntimeError(open("ERROR.txt", "r").read())
      RuntimeError:
      ###########################################################################################
      The package you are trying to install is only a placeholder project on PyPI.org repository.
      To install Torch-TensorRT please run the following command:
      
      $ pip install torch-tensorrt -f https://github.com/NVIDIA/Torch-TensorRT/releases
      ###########################################################################################
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

清华 不行

╰─➤  pip install torch-tensorrt -f https://github.com/NVIDIA/Torch-TensorRT/releases -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Looking in links: https://github.com/NVIDIA/Torch-TensorRT/releases
Collecting torch-tensorrt
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f3/5e/81c357454c59acedb1b83bfa1e2032f95bde827b5631bb695af6911f5a14/torch-tensorrt-0.0.0.post1.tar.gz (9.0 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-z3s3hdj1/torch-tensorrt_668cdb167fd94274bb2438b6ca5b94ef/setup.py", line 125, in <module>
          raise RuntimeError(open("ERROR.txt", "r").read())
      RuntimeError:
      ###########################################################################################
      The package you are trying to install is only a placeholder project on PyPI.org repository.
      To install Torch-TensorRT please run the following command:
      
      $ pip install torch-tensorrt -f https://github.com/NVIDIA/Torch-TensorRT/releases
      ###########################################################################################
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
阅读 3.5k
2 个回答

图片.png

解决方案,把 wheel 文件下载到本地,本地安装就行

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏