在运行模型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

END

本文标题:Centos7运行python脚本时报错No module named 'onnx_graphsurgeon'

本文作者:宇宙最帅的男人

本文链接:https://lolicp.com/linux/202318593.html

版权声明:转载或者引用本文内容请注明来源及原作者,本文著作权归作者 (宇宙最帅的男人) 所有。

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

最后修改:2023 年 07 月 18 日
如果觉得我的文章对你有用,请随意赞赏