scipy: BUG: Cannot install SciPy using pip on Raspberry Pi
Describe your issue.
Tried to install scipy through pip3 install -3 requirements.txt with the following:
librosa==0.6.3 numpy pandas soundfile==0.9.0 wave scikit-learn==0.24.2 tqdm==4.28.1 matplotlib==2.2.3 pyaudio==0.2.11
but it gave an error. Already tried using sudo apt-get install python3-scipy, but still the same issue happens.
Reproducing Code Example
N/A - all I did is run sudo LLVM_CONFIG=`which llvm-config-11` pip3 install -r requirements.txt
Error message
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [55 lines of output]
The Meson build system
Version: 0.62.2
Source dir: /tmp/pip-install-93y57wnw/scipy_34185744f91f4e619985e97d31e27821
Build dir: /tmp/pip-install-93y57wnw/scipy_34185744f91f4e619985e97d31e27821/.mesonpy-b9th5ncm/build
Build type: native build
Project name: SciPy
Project version: 1.9.0
C compiler for the host machine: cc (gcc 8.3.0 "cc (Raspbian 8.3.0-6+rpi1) 8.3.0")
C linker for the host machine: cc ld.bfd 2.31.1
C++ compiler for the host machine: c++ (gcc 8.3.0 "c++ (Raspbian 8.3.0-6+rpi1) 8.3.0")
C++ linker for the host machine: c++ ld.bfd 2.31.1
Host machine cpu family: arm
Host machine cpu: armv7l
Compiler for C supports arguments -Wno-unused-but-set-variable: YES
Library m found: YES
Fortran compiler for the host machine: gfortran (gcc 8.3.0 "GNU Fortran (Raspbian 8.3.0-6+rpi1) 8.3.0")
Fortran linker for the host machine: gfortran ld.bfd 2.31.1
Program cython found: YES (/tmp/pip-build-env-wco6m20p/overlay/bin/cython)
Program pythran found: YES (/tmp/pip-build-env-wco6m20p/overlay/bin/pythran)
Program cp found: YES (/usr/bin/cp)
Program python3 found: YES (/usr/local/bin/python3.9)
Found pkg-config: /usr/bin/pkg-config (0.29)
../../scipy/meson.build:40:0: ERROR: Command "/usr/local/bin/python3.9 -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-93y57wnw/scipy_34185744f91f4e619985e97d31e27821/.mesonpy-b9th5ncm/build/meson-logs/meson-log.txt
+ meson setup --native-file=/tmp/pip-install-93y57wnw/scipy_34185744f91f4e619985e97d31e27821/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2 --prefix=/usr/local /tmp/pip-install-93y57wnw/scipy_34185744f91f4e619985e97d31e27821 /tmp/pip-install-93y57wnw/scipy_34185744f91f4e619985e97d31e27821/.mesonpy-b9th5ncm/build
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.9/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-wco6m20p/overlay/lib/python3.9/site-packages/mesonpy/__init__.py", line 909, in get_requires_for_build_wheel
with _project(config_settings) as project:
File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/tmp/pip-build-env-wco6m20p/overlay/lib/python3.9/site-packages/mesonpy/__init__.py", line 888, in _project
with Project.with_temp_working_dir(
File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/tmp/pip-build-env-wco6m20p/overlay/lib/python3.9/site-packages/mesonpy/__init__.py", line 547, in with_temp_working_dir
yield cls(source_dir, tmpdir, build_dir)
File "/tmp/pip-build-env-wco6m20p/overlay/lib/python3.9/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-wco6m20p/overlay/lib/python3.9/site-packages/mesonpy/__init__.py", line 494, in _configure
self._meson(
File "/tmp/pip-build-env-wco6m20p/overlay/lib/python3.9/site-packages/mesonpy/__init__.py", line 477, in _meson
return self._proc('meson', *args)
File "/tmp/pip-build-env-wco6m20p/overlay/lib/python3.9/site-packages/mesonpy/__init__.py", line 472, in _proc
subprocess.check_call(list(args))
File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['meson', 'setup', '--native-file=/tmp/pip-install-93y57wnw/scipy_34185744f91f4e619985e97d31e27821/.mesonpy-native-file.ini', '-Ddebug=false', '-Doptimization=2', '--prefix=/usr/local', '/tmp/pip-install-93y57wnw/scipy_34185744f91f4e619985e97d31e27821', '/tmp/pip-install-93y57wnw/scipy_34185744f91f4e619985e97d31e27821/.mesonpy-b9th5ncm/build']' returned non-zero exit status 1.
[end of output]
SciPy/NumPy/Python version information
Python 3.9 - NumPy 1.22.4
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 17 (9 by maintainers)
Ah great, that explains it. Thanks for following up @yumemio. So I think we’re good here, all that’s needed is to improve the stdout output on build failures, which is https://github.com/mesonbuild/meson-python/issues/246. So I’ll close this again.
Thanks @yumemio, that detailed output helped clear something up. Pip’s
--no-clean
leaves behind the build environment, but that doesn’t help us here. The SciPy build itself, done bymeson-python
, uses atmpdir
as well and it gets cleaned up. What we need instead of--no-clean
is to explicitly specify the build directory to use. This works for me:That leaves behind a local
build/
dir with the neededmeson-log.txt
in it. Could you try that?Yep – it’s a raspberry pi 3b+ with Buster in it – and it fixed itself when I downgraded the Python from 3.9 to 3.7 due to some “glibc” errors.