python系列&deep_study系列:【已解决】 error: subprocess-exited-with-error × python setup.py egg_info did not r
【已解决】 error: subprocess-exited-with-error × python setup.py egg_info did not run successfully.
【已解决】 error: subprocess-exited-with-error × python setup.py egg_info did not run successfully.
问题描述
今天遇到这个问题:ImportError: cannot import name 'packaging' from 'pkg_resources' (/home/visionx/anaconda3/envs/gdem/lib/python3.8/site-packages/pkg_resources/__init__.py)
,其实这种问题很常见,希望给大家统一讲一下如何处理的,我们从头开始!
具体描述为:
Collecting torch_sparse
Using cached torch_sparse-0.6.18.tar.gz (209 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 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-mu4fnmkw/torch-sparse_7b1f67db8d584e36bedf832159648d4b/setup.py", line 11, in <module>
from torch.utils.cpp_extension import (
File "/home/visionx/anaconda3/envs/gdem/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 28, in <module>
from pkg_resources import packaging # type: ignore[attr-defined]
ImportError: cannot import name 'packaging' from 'pkg_resources' (/home/visionx/anaconda3/envs/gdem/lib/python3.8/site-packages/pkg_resources/__init__.py)
[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.
(gdem) visionx@visionx:/media/visionx/monica/project24/GDEM$ pip install torch_sparse
Collecting torch_sparse
Using cached torch_sparse-0.6.18.tar.gz (209 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 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-11nj3e0o/torch-sparse_e89b9d926f354738a403de89b0c3a695/setup.py", line 11, in <module>
from torch.utils.cpp_extension import (
File "/home/visionx/anaconda3/envs/gdem/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 28, in <module>
from pkg_resources import packaging # type: ignore[attr-defined]
ImportError: cannot import name 'packaging' from 'pkg_resources' (/home/visionx/anaconda3/envs/gdem/lib/python3.8/site-packages/pkg_resources/__init__.py)
[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.
看图:
原因分析和解决
1、在我的主页搜索torch
2、结果如下,点击113这个
3、选择这个网址https://pytorch-geometric.com/whl/
4、选择对应版本安装,命令为:
pip install torch_sparse-0.6.18+pt21cu118-cp38-cp38-linux_x86_64.whl
5、解决
相关链接
完结撒花
结束了,都结束了。
【已解决】 error: subprocess-exited-with-error × python setup.py egg_info did not run successfully.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)