I'm on Ubuntu 22.04 "Jammy". I've installed pypy3
, and I'm trying to install scipy
for it.
This error message was printed out:
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.
I focused on this line:
../../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.
As far I've understood, this "command" is invalid because of the nested ""
s. Either the inner ""
must be escaped, or be replaced by single quotes ''
.
How should I resolve this bug?
SciPy 1.9.0 was released last week and does not yet build using the new meson backend. The best place to track availablility is on the scipy issue tracker, for instance this issue. I would recommend using the pre-built conda packages for PyPy since that will save a lot of headache around building complicated packages like Scipy. Directions are here https://conda-forge.org/docs/user/tipsandtricks.html#using-pypy-as-an-interpreter.