无法使用 pypy 安装 scipy(g++ 构建错误)

Cannot install scipy with pypy (g++ build error)

截至 2020 年,可以使用 pypy 安装 scipy。 ()

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]

以下是对我有用的方法。我解压了 latest nightly

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

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

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

  • 升级 pip
  • 正在降级 pip
  • 使用--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 库路径。