【subprocess-exited-with-error】pip安装tensorrt-9.3.0.post12.dev1.tar.gz

前情提要

本人已设置过清华源

https://pypi.tuna.tsinghua.edu.cn/simple

安装之前需要更新pip,安装nvidia-pyindex

python3 -m pip install --upgrade setuptools pip
python3 -m pip install nvidia-pyindex

报错内容

报错一:9.3.0版本无法安装

安装TensorRT官网指导安装时出现的报错:

# python3 -m pip install --pre --upgrade tensorrt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://pypi.ngc.nvidia.com
Collecting tensorrt
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/bc/70/d633add6eef5edf414f3ec48b3fe9b0116837cf4b935edc531ede2e65b00/tensorrt-9.3.0.post12.dev1.tar.gz (6.9 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 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-pd1g0qot/tensorrt_ab7006731a644e11b9e76fbb52612c47/setup.py", line 90, in <module>
          raise RuntimeError("Bad params")
      RuntimeError: Bad params
      [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.

报错二:8.6.1版本无法安装

安装中没有反应,只能手动取消

# pip install tensorrt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting tensorrt
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/46/08/da496b4f20890b6f717f159bbdda98e9248b560e712aa22cd9bb1daafe15/tensorrt-8.6.1.post1.tar.gz (18 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: tensorrt
  Building wheel for tensorrt (setup.py) ... |^canceled
ERROR: Operation cancelled by user

解决方案

解决一:设置英伟达源

pip config set global.index-url https://pypi.nvidia.com
python3 -m pip install --pre --upgrade tensorrt

这种方式安装的是最新版9.3.0
安装时弹出的查找地址为

Looking in indexes: https://pypi.nvidia.com, https://pypi.ngc.nvidia.com

解决二:设置清华源下的英伟达源

pip install tensorrt --extra-index-url https://pypi.nvidia.com

这种方式安装的是最旧版8.6.1
安装时弹出的查找地址为

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://pypi.ngc.nvidia.com, https://pypi.nvidia.com

后记

我安装的自然是最新版9.3.0

检验

python
import tensorrt
print(tensorrt.__version__)
# 9.3.0.post12.dev1
assert tensorrt.Builder(tensorrt.Logger())

到这里还没结束,在之后需要编译的时候,需要指定tensorrt的lib和include路径,用pip安装的话路径和别的安装方法(tar、deb)中的路径不太一样,千万要注意!

设置include路径

git clone https://github.com/NVIDIA/TensorRT.git
cd TensorRT
git submodule update --init --recursive

其中git submodule update --init --recursive运行后要检查是否有出现Failed,有话再次运行进行下载
这样include路径就确认了

设置lib路径

在python路径下找

which python
#/root/anaconda3/envs/sakura/bin/python
cd /root/anaconda3/envs/sakura/lib/python3.10/site-packages/tensorrt_libs
ls
# __init__.py  __pycache__  libnvinfer.so.9  libnvinfer_builder_resource.so.9.3.0  libnvinfer_plugin.so.9  libnvonnxparser.so.9

可以看到许多动态库.so文件
之后编译的时候只需要修改tensorrt的lib和include位置即可
include directories对应include
link directories对应lib

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当你在运行`pip install -e .`命令时,出现了`error: subprocess-exited-with-error`错误。这个错误通常表示在运行该命令时,子进程遇到了错误导致整个命令无法完成。根据引用的解决办法,你可以尝试以下几个步骤来解决这个问题: 1. 确认你的电脑上是否安装了所需的依赖库。你可以通过运行`pip list`命令来查看已安装的库列表,确保需要的库已经安装。 2. 检查你的操作系统是否是最新的,并且已经安装了最新的Python版本。某些依赖库可能只能在特定版本的Python上运行。你可以通过运行`python --version`命令来查看你的Python版本。 3. 如果你的Python版本过旧,并且你正在运行一个与Python版本不兼容的库,你可能需要安装一个新版本的Python。你可以通过运行`python -m ensurepip`命令来重新安装Python。 如果以上步骤都无法解决问题,你可以尝试重新安装Python。这可能需要删除旧版本的Python,并按照官方指南重新安装最新版本的Python。请确保在重新安装之前备份你的项目文件,以免丢失数据。 总结而言,`error: subprocess-exited-with-error`错误通常是由于与操作系统或Python版本有关的问题导致的。通过确认依赖库是否安装,更新操作系统和Python版本,以及重新安装Python,你有可能解决这个问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [pip intall 出现 error: subprocess-exited-with-error 错误的解决办法](https://blog.csdn.net/Jackfled/article/details/127046255)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [pip安装软件报错error subprocess-exited-with-error问题记录](https://blog.csdn.net/weixin_53742691/article/details/130931339)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值