将SciPy安装到PyPy时遇到内部语法错误



我在Ubuntu 22.04"Jammy";。我已经安装了pypy3,我正在尝试为它安装scipy

此错误消息已打印出来:

ndos@ndos-desktop:~$ pypy3 -m pip install scipy --upgrade
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: scipy in /usr/lib/python3/dist-packages (1.8.0)
Collecting scipy
Using cached scipy-1.9.0.tar.gz (42.0 MB)
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
╰─> [54 lines of output]
The Meson build system
Version: 0.62.2
Source dir: /tmp/pip-install-2ov2xi0h/scipy_8ec7415f7e94440e82d27b79cc387e5d
Build dir: /tmp/pip-install-2ov2xi0h/scipy_8ec7415f7e94440e82d27b79cc387e5d/.mesonpy-mv4soouy/build
Build type: native build
Project name: SciPy
Project version: 1.9.0
C compiler for the host machine: cc (gcc 11.2.0 "cc (Ubuntu 11.2.0-19ubuntu1) 11.2.0")
C linker for the host machine: cc ld.bfd 2.38
C++ compiler for the host machine: c++ (gcc 11.2.0 "c++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0")
C++ linker for the host machine: c++ ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wno-unused-but-set-variable: YES
Library m found: YES
Fortran compiler for the host machine: gfortran (gcc 11.2.0 "GNU Fortran (Ubuntu 11.2.0-19ubuntu1) 11.2.0")
Fortran linker for the host machine: gfortran ld.bfd 2.38
Program cython found: YES (/tmp/pip-build-env-ndkikzz6/overlay/bin/cython)
Program pythran found: YES (/tmp/pip-build-env-ndkikzz6/overlay/bin/pythran)
Program cp found: YES (/usr/bin/cp)
Program python3 found: YES (/usr/bin/pypy3)

../../scipy/meson.build:40:0: ERROR: Command "/usr/bin/pypy3 -c import os; os.chdir(".."); import numpy; print(numpy.get_include())" failed with status 1.

A full log can be found at /tmp/pip-install-2ov2xi0h/scipy_8ec7415f7e94440e82d27b79cc387e5d/.mesonpy-mv4soouy/build/meson-logs/meson-log.txt
+ meson setup --native-file=/tmp/pip-install-2ov2xi0h/scipy_8ec7415f7e94440e82d27b79cc387e5d/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2 --prefix=/usr /tmp/pip-install-2ov2xi0h/scipy_8ec7415f7e94440e82d27b79cc387e5d /tmp/pip-install-2ov2xi0h/scipy_8ec7415f7e94440e82d27b79cc387e5d/.mesonpy-mv4soouy/build
Traceback (most recent call last):
File "/home/ndos/.local/lib/pypy3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/home/ndos/.local/lib/pypy3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/ndos/.local/lib/pypy3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-ndkikzz6/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 909, in get_requires_for_build_wheel
with _project(config_settings) as project:
File "/usr/lib/pypy3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/tmp/pip-build-env-ndkikzz6/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 889, in _project
build_dir=config_settings.get('builddir'),
File "/usr/lib/pypy3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/tmp/pip-build-env-ndkikzz6/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 547, in with_temp_working_dir
yield cls(source_dir, tmpdir, build_dir)
File "/tmp/pip-build-env-ndkikzz6/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 463, in __init__
self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
File "/tmp/pip-build-env-ndkikzz6/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 500, in _configure
*setup_args,
File "/tmp/pip-build-env-ndkikzz6/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 477, in _meson
return self._proc('meson', *args)
File "/tmp/pip-build-env-ndkikzz6/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 472, in _proc
subprocess.check_call(list(args))
File "/usr/lib/pypy3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['meson', 'setup', '--native-file=/tmp/pip-install-2ov2xi0h/scipy_8ec7415f7e94440e82d27b79cc387e5d/.mesonpy-native-file.ini', '-Ddebug=false', '-Doptimization=2', '--prefix=/usr', '/tmp/pip-install-2ov2xi0h/scipy_8ec7415f7e94440e82d27b79cc387e5d', '/tmp/pip-install-2ov2xi0h/scipy_8ec7415f7e94440e82d27b79cc387e5d/.mesonpy-mv4soouy/build']' returned non-zero exit status 1.
[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.

我专注于这一行:

../../scipy/meson.build:40:0: ERROR: Command "/usr/bin/pypy3 -c import os; os.chdir(".."); import numpy; print(numpy.get_include())" failed with status 1.

据我所知;命令";由于嵌套的""s而无效。必须转义内部"",或者用单引号''替换。

我应该如何解决此错误?

SciPy 1.9.0上周发布,尚未使用新的介子后端构建。跟踪可用性的最佳位置是在scipy问题跟踪器上,例如这个问题。我建议使用PyPy的预构建的conda包,因为这将省去构建像Scipy这样的复杂包时的很多麻烦。方向在这里https://conda-forge.org/docs/user/tipsandtricks.html#using-pypy作为翻译。

最新更新