当前位置:首页 » 《关注互联网》 » 正文

Python 安装库报错 “python setup.py egg_info did not run successfully.“

13 人参与  2024年03月21日 18:27  分类 : 《关注互联网》  评论

点击全文阅读


文章目录

1. Python 安装库报错2. 问题解决3. 参考

1. Python 安装库报错

有时 Python 用 pip install 安装库的时候会报错,python setup.py egg_info did not run successfully. ,我在安装 deepspeed 报错示例如下:

  Preparing metadata (setup.py) ... error  error: subprocess-exited-with-error    × python setup.py egg_info did not run successfully.  │ exit code: 1  ╰─> [20 lines of output]      Traceback (most recent call last):        File "<string>", line 2, in <module>        File "<pip-setuptools-caller>", line 34, in <module>        File "/private/var/folders/hv/g_8qfj_56k98k8tnpf_58k980000gn/T/pip-install-r4m2v95f/deepspeed_bb04440e1d854d09a2dde2b5d62ad864/setup.py", line 38, in <module>          from op_builder.all_ops import ALL_OPS        File "/private/var/folders/hv/g_8qfj_56k98k8tnpf_58k980000gn/T/pip-install-r4m2v95f/deepspeed_bb04440e1d854d09a2dde2b5d62ad864/op_builder/all_ops.py", line 29, in <module>          builder = get_accelerator().create_op_builder(member_name)        File "/private/var/folders/hv/g_8qfj_56k98k8tnpf_58k980000gn/T/pip-install-r4m2v95f/deepspeed_bb04440e1d854d09a2dde2b5d62ad864/accelerator/mps_accelerator.py", line 234, in create_op_builder          builder_class = self.get_op_builder(op_name)        File "/private/var/folders/hv/g_8qfj_56k98k8tnpf_58k980000gn/T/pip-install-r4m2v95f/deepspeed_bb04440e1d854d09a2dde2b5d62ad864/accelerator/mps_accelerator.py", line 241, in get_op_builder          from deepspeed.ops.op_builder.cpu import NotImplementedBuilder        File "/private/var/folders/hv/g_8qfj_56k98k8tnpf_58k980000gn/T/pip-install-r4m2v95f/deepspeed_bb04440e1d854d09a2dde2b5d62ad864/deepspeed/__init__.py", line 21, in <module>          from . import ops        File "/private/var/folders/hv/g_8qfj_56k98k8tnpf_58k980000gn/T/pip-install-r4m2v95f/deepspeed_bb04440e1d854d09a2dde2b5d62ad864/deepspeed/ops/__init__.py", line 6, in <module>          from . import adam        File "/private/var/folders/hv/g_8qfj_56k98k8tnpf_58k980000gn/T/pip-install-r4m2v95f/deepspeed_bb04440e1d854d09a2dde2b5d62ad864/deepspeed/ops/adam/__init__.py", line 6, in <module>          from .cpu_adam import DeepSpeedCPUAdam        File "/private/var/folders/hv/g_8qfj_56k98k8tnpf_58k980000gn/T/pip-install-r4m2v95f/deepspeed_bb04440e1d854d09a2dde2b5d62ad864/deepspeed/ops/adam/cpu_adam.py", line 7, in <module>          from cpuinfo import get_cpu_info      ModuleNotFoundError: No module named 'cpuinfo'      [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.

可能是 python 依赖的库版本不对

2. 问题解决

更新必须的库

pip install --upgrade pippip install --upgrade setuptoolspip install ez_setup

上面安装更新完成之后,再执行 pip install 命令,执行成功,例如:

 smaller@SmallerdeMacBook-Pro: pip install deepspeed                                                                                                      ✔  564  17:10:03Collecting deepspeed  Using cached deepspeed-0.13.1.tar.gz (1.3 MB)  Installing build dependencies ... done  Getting requirements to build wheel ... done  Preparing metadata (pyproject.toml) ... doneCollecting hjson (from deepspeed)  Using cached hjson-3.1.0-py3-none-any.whl (54 kB)Collecting ninja (from deepspeed)  Using cached ninja-1.11.1.1-py2.py3-none-macosx_10_9_universal2.macosx_10_9_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl.metadata (5.3 kB)Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from deepspeed) (1.26.3)Requirement already satisfied: packaging>=20.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from deepspeed) (23.2)Requirement already satisfied: psutil in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from deepspeed) (5.9.8)Collecting py-cpuinfo (from deepspeed)  Using cached py_cpuinfo-9.0.0-py3-none-any.whl (22 kB)Collecting pydantic (from deepspeed)  Using cached pydantic-2.5.3-py3-none-any.whl.metadata (65 kB)Collecting pynvml (from deepspeed)  Using cached pynvml-11.5.0-py3-none-any.whl (53 kB)Requirement already satisfied: torch in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from deepspeed) (2.1.2)Requirement already satisfied: tqdm in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from deepspeed) (4.66.1)Collecting annotated-types>=0.4.0 (from pydantic->deepspeed)  Downloading annotated_types-0.6.0-py3-none-any.whl.metadata (12 kB)Collecting pydantic-core==2.14.6 (from pydantic->deepspeed)  Downloading pydantic_core-2.14.6-cp310-cp310-macosx_10_7_x86_64.whl.metadata (6.5 kB)Requirement already satisfied: typing-extensions>=4.6.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pydantic->deepspeed) (4.9.0)Requirement already satisfied: filelock in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from torch->deepspeed) (3.13.1)Requirement already satisfied: sympy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from torch->deepspeed) (1.12)Requirement already satisfied: networkx in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from torch->deepspeed) (3.2.1)Requirement already satisfied: jinja2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from torch->deepspeed) (3.1.3)Requirement already satisfied: fsspec in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from torch->deepspeed) (2023.10.0)Requirement already satisfied: MarkupSafe>=2.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from jinja2->torch->deepspeed) (2.1.4)Requirement already satisfied: mpmath>=0.19 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from sympy->torch->deepspeed) (1.3.0)Downloading ninja-1.11.1.1-py2.py3-none-macosx_10_9_universal2.macosx_10_9_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl (270 kB)   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 270.6/270.6 kB 21.5 kB/s eta 0:00:00Downloading pydantic-2.5.3-py3-none-any.whl (381 kB)   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 381.9/381.9 kB 13.7 kB/s eta 0:00:00Downloading pydantic_core-2.14.6-cp310-cp310-macosx_10_7_x86_64.whl (1.9 MB)   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 21.8 kB/s eta 0:00:00Downloading annotated_types-0.6.0-py3-none-any.whl (12 kB)Building wheels for collected packages: deepspeed  Building wheel for deepspeed (pyproject.toml) ... done  Created wheel for deepspeed: filename=deepspeed-0.13.1-py3-none-any.whl size=1350251 sha256=e94dff2604fd66ab4d2dd7d5d3fdd6571e0859a009aa471b74c548a2009f7565  Stored in directory: /Users/smaller/Library/Caches/pip/wheels/0f/fb/b5/b159b3500525eca167d8ca6e3a7e224b6075045cac90f47cf7Successfully built deepspeedInstalling collected packages: py-cpuinfo, ninja, hjson, pynvml, pydantic-core, annotated-types, pydantic, deepspeedSuccessfully installed annotated-types-0.6.0 deepspeed-0.13.1 hjson-3.1.0 ninja-1.11.1.1 py-cpuinfo-9.0.0 pydantic-2.5.3 pydantic-core-2.14.6 pynvml-11.5.0

3. 参考

https://zhuanlan.zhihu.com/p/581112365


点击全文阅读


本文链接:http://zhangshiyu.com/post/83227.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1