【问题标题】:Cannot install scipy with pypy (g++ build error)无法使用 pypy 安装 scipy(g++ 构建错误)
【发布时间】:2020-06-01 14:42:59
【问题描述】:

从 2020 年开始,可以使用 pypy 安装 scipy。 (Is it possible to install scipy under pypy?)

pypy3 -mpip install scipy

但是,车轮因此类错误而失败:

  error: Command "g++ -pthread -DNDEBUG -O2 -fPIC -I/tmp/pip-build-env-lfdsn__t/overlay/site-packages/numpy/core/include -I/usr/lib/pypy3/include -c scipy/_lib/_uarray/_uarray_dispatch.cxx -o build/temp.linux-x86_64-3.6/scipy/_lib/_uarray/_uarray_dispatch.o -MMD -MF build/temp.linux-x86_64-3.6/scipy/_lib/_uarray/_uarray_dispatch.o.d -std=c++14 -fvisibility=hidden" failed with exit status 1


  ERROR: Failed building wheel for scipy

scipy 构建失败 错误:无法为使用 PEP 517 且无法直接安装的 scipy 构建轮子

使用 --no-use-pep517 选项给出类似的结果:

    error: Command "g++ -pthread -DNDEBUG -O2 -fPIC -I/home/ezako/.local/lib/pypy3.6/site-packages/numpy/core/include -I/usr/lib/pypy3/include -c scipy/_lib/_uarray/_uarray_dispatch.cxx -o build/temp.linux-x86_64-3.6/scipy/_lib/_uarray/_uarray_dispatch.o -MMD -MF build/temp.linux-x86_64-3.6/scipy/_lib/_uarray/_uarray_dispatch.o.d -std=c++14 -fvisibility=hidden" failed with exit status 1 
ERROR: Command errored out with exit status 1: /usr/bin/pypy3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2ffzze2v/scipy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2ffzze2v/scipy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8avik0f1/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ezako/.local/include/python3.6/scipy Check the logs for full command output.

Numpy 已成功安装 pypy3。

➜ pypy3 -V
Python 3.6.9 (7.3.0+dfsg-1~ppa1~ubuntu19.04, Dec 26 2019, 11:14:16)
[PyPy 7.3.0 with GCC 8.3.0]

【问题讨论】:

  • pypy -V 显示什么?您应该至少使用 PyPy 7.3.0
  • ... 为什么是g++ 而不是gcc
  • 已使用此信息编辑答案。
  • 您可以尝试使用pypy3 -mpip install -v scipy 并报告实际失败的原因吗?这似乎是一些汇编,但究竟是什么?

标签: python-3.x scipy pypy


【解决方案1】:

这对我有用。我打开了latest nightly

pypy -mensurepip
pypy -mpip install --upgrade pip setuptools wheel
pypy -mpip install numpy pybind11
pypy -mpip install scipy

显然您需要单独安装 pybind11,因为它在 PEP 517 隔离版本中无法正常工作。

【讨论】:

  • 有效!在我之前的测试中,我还在 scipy 之前安装了 pybind11。我的猜测是夜间构建修复了我遇到的错误。
【解决方案2】:

我遇到了同样的问题,但我找到的解决方案都没有帮助我。 我试过了:

  • 升级点子
  • 降级点子
  • 使用--no-cache-dir标志
  • 升级setuptoolswheel
  • 使用--default-pip标志
  • 使用--no-use-pep517标志

所以我尝试使用official manual 手动安装它,一切正常。

git clone https://github.com/scipy/scipy.git
cd scipy
git submodule update --init
pypy -mpip install .

您可能需要设置BLASLAPACKATLAS 库路径。

【讨论】:

    猜你喜欢
    • 2021-06-22
    • 2020-08-05
    • 2016-01-05
    • 1970-01-01
    • 2021-01-09
    • 1970-01-01
    • 1970-01-01
    • 2016-08-03
    • 2016-04-16
    相关资源
    最近更新 更多