在运行模型python脚本时报错如下内容:
Traceback (most recent call last):
File "tools/onnx_custom.py", line 4, in <module>
import onnx_graphsurgeon
ModuleNotFoundError: No module named 'onnx_graphsurgeon'
尝试安装报错:
[root@23cd70ab35ae data1]# python3 -m pip install onnx_graphsurgeon --trusted-host pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
WARNING: Running pip install with root privileges is generally not a good idea. Try `python3 -m pip install --user` instead.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting onnx_graphsurgeon
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e8/c8/26f338891498d8a193a9d1698832399979636273f26a67a555e3952a3a7f/onnx-graphsurgeon-0.0.1.dev5.tar.gz
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-i8fljf91/onnx-graphsurgeon/setup.py'"'"'; __file__='"'"'/tmp/pip-install-i8fljf91/onnx-graphsurgeon/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-i8fljf91/onnx-graphsurgeon/pip-egg-info
cwd: /tmp/pip-install-i8fljf91/onnx-graphsurgeon/
Complete output (16 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-i8fljf91/onnx-graphsurgeon/setup.py", line 150, 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.
This package is hosted on NVIDIA Python Package Index.
This package can be installed as:
$ pip install nvidia-pyindex
$ pip install onnx-graphsurgeon
```
###########################################################################################
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
#### 解决办法
python3 -m pip install nvidia-pyindex --trusted-host pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pip install onnx-graphsurgeon --trusted-host pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple