【pip安装包时gcc编译错误】pip subprocess to install build dependencies did not run successfully.

前记:以前一直玩的都是微软的windows系列操作系统,最近刚转macOS 12版本,遇到各种各样奇奇怪怪的错误在所难免,不妨在此总结一下。

在mac OS中用pip安装《动手学深度学习》中介绍的d2l库时,发生了下面的错误:
pip subprocess to install build dependencies did not run successfully.

error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

我用miniconda管理包,建立环境d2l再用pip install -U d2l安装d2l库,产生了报错(报错的信息有好几百行,只截取了我认为重要的信息):

gcc: numpy/core/src/npymath/halffloat.c
            gcc: numpy/core/src/common/npy_longdouble.c
            gcc: numpy/core/src/common/numpyos.c
            gcc: /private/var/folders/g2/ssk3r1ms6yv_kncfrjk1m8yh0000gn/T/pip-install-n13kfd6f/numpy_e36e8d9c4ff249228d2bc9392e82e109/numpy/_build_utils/src/apple_sgemv_fix.c
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            error: Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/kongmu/miniconda3/envs/d2l/include -arch arm64 -I/Users/kongmu/miniconda3/envs/d2l/include -arch arm64 -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-11.1-arm64-3.8/numpy/core/src/umath -Ibuild/src.macosx-11.1-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-11.1-arm64-3.8/numpy/core/src/common -Inumpy/core/include -Ibuild/src.macosx-11.1-arm64-3.8/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/Users/kongmu/miniconda3/envs/d2l/include/python3.8 -Ibuild/src.macosx-11.1-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-11.1-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-11.1-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-11.1-arm64-3.8/numpy/core/src/npymath -c numpy/core/src/multiarray/alloc.c -o build/temp.macosx-11.1-arm64-cpython-38/numpy/core/src/multiarray/alloc.o -MMD -MF build/temp.macosx-11.1-arm64-cpython-38/numpy/core/src/multiarray/alloc.o.d -faltivec -I/System/Library/Frameworks/vecLib.framework/Headers" failed with exit status 1
            [end of output]

错误信息中出现了很多gcc编译器的报错信息,初步猜测错误原因是macOS版本比较新,有些库pip没有找到与系统相匹配的whl包,于是就下载源码重新编译打包成whl包进行安装,结果造成无法编译的问题。

解决方法

在下面这些网站上找已经编译打包好的whl包:

Windows:
https://www.lfd.uci.edu/~gohlke/pythonlibs/
直接用Ctrl + F查找想要的包名和版本号然后点击下载链接就可以了。

Windows 和 macOS:

这里以pandas为例:

先访问pypi.org

然后在搜索框中搜索用pip在线安装不成功的库,比如pandas

点击导航栏上的Download files后,找到自己想要的版本下载即可(我是macOS 12系统,目前没有适配,并且我的python版本是3.11,那么可以选用padas-***-cp311-macosx_11_0_arm64.whl,这里架构选用arm64的):

pandas库:https://pypi.org/project/pandas/#files
在这里插入图片描述

如果下载速度过慢,可以在清华源中查找包下载(这里找的是numpy):
https://pypi.tuna.tsinghua.edu.cn/simple/numpy/

清华源:https://pypi.tuna.tsinghua.edu.cn/simple/

查找到点击自己想要的包就可以直接在浏览器中下载完成,十分方便。

树莓派4b使用pip安装paddle出现错误python -m pip install paddle -i https://pypi.tuna.tsinghua.edu.cn/simple --no-cache-dirDefaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://www.piwheels.org/simple Collecting paddle Downloading https://pypi.tuna.tsinghua.edu.cn/packages/55/cf/e4b6b9a54d2f072e4491e34317bf5f5fea260da8a3072e641832dc9ce770/paddle-1.0.2.tar.gz (579 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 579.0/579.0 kB 1.8 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [19 lines of output] Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module> main() File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-_506dkis/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/tmp/pip-build-env-_506dkis/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-_506dkis/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 487, in run_setup super(_BuildMetaLegacyBackend, File "/tmp/pip-build-env-_506dkis/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in run_setup exec(code, locals()) File "<string>", line 3, in <module> File "/tmp/pip-install-514wqan3/paddle_7c2bfe27eaa349ecb89b325af305b6fa/paddle/__init__.py", line 5, in <module> import common, dual, tight, data, prox ModuleNotFoundError: No module named 'common' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip.
06-13
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值