scipy: BUG: pip install scipy from git fails with `"openblas" not found`
Describe your issue.
This comes from SymPy CI: https://github.com/sympy/sympy/pull/23513
A few days ago it successfully built and tested NumPy and SciPy on Python 3.11b1 from git using pip but now the same setup fails to build SciPy with
../../scipy/meson.build:120:0: ERROR: Dependency "openblas" not found, tried pkgconfig and cmake
Maybe this would work with apt install libopenblas-dev liblapack-dev
but it was working before so should it be expected to work still?
This was the last successful run (the build was successful although a test later failed): https://github.com/sympy/sympy/runs/6598088659?check_suite_focus=true
Reproducing Code Example
# Ubuntu 20.04.4 with Python 3.11b1 running in GA
sudo apt install antlr4 libgfortran5 gfortran libmpfr-dev libmpc-dev
pip install --upgrade pip wheel
pip install git+https://github.com/cython/cython@master
pip install git+https://github.com/numpy/numpy@main
pip install git+https://github.com/scipy/scipy@main
Error message
Run pip install git+https://github.com/numpy/numpy@main
pip install git+https://github.com/numpy/numpy@main
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.11.0-beta.1/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib
Collecting git+https://github.com/numpy/numpy@main
Cloning https://github.com/numpy/numpy (to revision main) to /tmp/pip-req-build-a992dsfx
Running command git clone --filter=blob:none --quiet https://github.com/numpy/numpy /tmp/pip-req-build-a992dsfx
Resolved https://github.com/numpy/numpy to commit 68f3a12f4cc9310a7d60f9878af72cf98e7233f3
Running command git submodule update --init --recursive -q
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: numpy
Building wheel for numpy (pyproject.toml): started
Building wheel for numpy (pyproject.toml): still running...
Building wheel for numpy (pyproject.toml): still running...
Building wheel for numpy (pyproject.toml): still running...
Building wheel for numpy (pyproject.toml): still running...
Building wheel for numpy (pyproject.toml): finished with status 'done'
Created wheel for numpy: filename=numpy-1.24.0.dev0+75.g68f3a12f4-cp311-cp311-linux_x86_64.whl size=22029574 sha256=ed58cdbe5b547632f5a45e8ab48e0c200b8f247a91e8e945c457a7899185724a
Stored in directory: /tmp/pip-ephem-wheel-cache-jo9owv4z/wheels/ad/e8/55/3b4372ddf4700df1fb35dc513aacd83756396e870c5a6f8ece
Successfully built numpy
Installing collected packages: numpy
Successfully installed numpy-1.24.0.dev0+75.g68f3a12f4
Run pip install git+https://github.com/scipy/scipy@main
Collecting git+https://github.com/scipy/scipy@main
Cloning https://github.com/scipy/scipy (to revision main) to /tmp/pip-req-build-b76e9_br
Running command git clone --filter=blob:none --quiet https://github.com/scipy/scipy /tmp/pip-req-build-b76e9_br
Resolved https://github.com/scipy/scipy to commit 6c51ed7aa4230d9fc08d099773b66f61e9828e97
Running command git submodule update --init --recursive -q
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [72 lines of output]
The Meson build system
Version: 0.62.1
Source dir: /tmp/pip-req-build-b76e9_br
Build dir: /tmp/pip-req-build-b76e9_br/.mesonpy-_wsc8qd3/build
Build type: native build
Project name: SciPy
Project version: 1.9.0.dev0
C compiler for the host machine: cc (gcc 9.4.0 "cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
C linker for the host machine: cc ld.bfd 2.34
C++ compiler for the host machine: c++ (gcc 9.4.0 "c++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
C++ linker for the host machine: c++ ld.bfd 2.34
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 9.4.0 "GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
Fortran linker for the host machine: gfortran ld.bfd 2.34
Program cython found: YES (/tmp/pip-build-env-4bh3e24n/overlay/bin/cython)
Program pythran found: YES (/tmp/pip-build-env-4bh3e24n/overlay/bin/pythran)
Program cp found: YES (/usr/bin/cp)
Program python3 found: YES (/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/bin/python)
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Library npymath found: YES
Library npyrandom found: YES
Found CMake: /usr/local/bin/cmake (3.23.1)
Run-time dependency openblas found: NO (tried pkgconfig and cmake)
../../scipy/meson.build:120:0: ERROR: Dependency "openblas" not found, tried pkgconfig and cmake
A full log can be found at /tmp/pip-req-build-b76e9_br/.mesonpy-_wsc8qd3/build/meson-logs/meson-log.txt
+ meson setup --native-file=/tmp/pip-req-build-b76e9_br/.mesonpy-native-file.ini -Ddebug=false -Dstrip=true -Doptimization=2 --prefix=/opt/hostedtoolcache/Python/3.11.0-beta.1/x64 /tmp/pip-req-build-b76e9_br /tmp/pip-req-build-b76e9_br/.mesonpy-_wsc8qd3/build
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
^^^^^^
File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/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-4bh3e24n/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 805, in get_requires_for_build_wheel
with _project(config_settings) as project:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "/tmp/pip-build-env-4bh3e24n/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 784, in _project
with Project.with_temp_working_dir(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "/tmp/pip-build-env-4bh3e24n/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 479, in with_temp_working_dir
yield cls(source_dir, tmpdir, build_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-4bh3e24n/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 423, in __init__
self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-4bh3e24n/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 450, in _configure
self._meson(
^^^^^^^^^^^^
File "/tmp/pip-build-env-4bh3e24n/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 438, in _meson
return self._proc('meson', *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-4bh3e24n/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 434, in _proc
subprocess.check_call(list(args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/subprocess.py", line 402, in check_call
raise CalledProcessError(retcode, cmd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subprocess.CalledProcessError: Command '['meson', 'setup', '--native-file=/tmp/pip-req-build-b76e9_br/.mesonpy-native-file.ini', '-Ddebug=false', '-Dstrip=true', '-Doptimization=2', '--prefix=/opt/hostedtoolcache/Python/3.11.0-beta.1/x64', '/tmp/pip-req-build-b76e9_br', '/tmp/pip-req-build-b76e9_br/.mesonpy-_wsc8qd3/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.
Error: Process completed with exit code 1.
SciPy/NumPy/Python version information
scipy/numpy from git and python 3.11b1
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 65 (33 by maintainers)
Links to this issue
Commits related to this issue
- Inject pkg-config path for fallback to work around scipy build bug on finding OpenBLAS. - https://github.com/scipy/scipy/issues/16308 — committed to xkszltl/Roaster by xkszltl 2 years ago
- BLD: make OpenBLAS detection work with CMake This is a fallback detection path, in case pkg-config fails to find `openblas`. CMake is case-sensitive, so we need to try the camelcase version of the na... — committed to rgommers/scipy by rgommers 2 years ago
- BLD: make OpenBLAS detection work with CMake (#16750) This is a fallback detection path, in case pkg-config fails to find `openblas`. CMake uses the camelcase version of the name. If CMake is ins... — committed to scipy/scipy by rgommers 2 years ago
- BLD: make OpenBLAS detection work with CMake (#16750) This is a fallback detection path, in case pkg-config fails to find `openblas`. CMake uses the camelcase version of the name. If CMake is ins... — committed to tylerjereddy/scipy by rgommers 2 years ago
- set scipy<1.9.0 to avoid build error with openblas https://github.com/scipy/scipy/issues/16308 — committed to knorth55/jsk_common by knorth55 a year ago
- set scipy<1.9.0 to avoid build error with openblas https://github.com/scipy/scipy/issues/16308 — committed to knorth55/jsk_common by knorth55 a year ago
- set scipy<1.9.0 to avoid build error with openblas https://github.com/scipy/scipy/issues/16308 — committed to knorth55/jsk_common by knorth55 a year ago
- max python version test 3.10 due ot scipy https://github.com/scipy/scipy/issues/16308 — committed to DavidDevoogdt/IMLCV by DavidDevoogdt a year ago
- Trying to fix https://github.com/scipy/scipy/issues/16308 in CI — committed to Sums-of-Products/sumu by jussiviinikka 9 months ago
- Trying to fix https://github.com/scipy/scipy/issues/16308 in CI — committed to Sums-of-Products/sumu by jussiviinikka 9 months ago
- Trying to fix https://github.com/scipy/scipy/issues/16308 in CI — committed to Sums-of-Products/sumu by jussiviinikka 9 months ago
- Trying to fix https://github.com/scipy/scipy/issues/16308 in CI — committed to Sums-of-Products/sumu by jussiviinikka 9 months ago
- Trying to fix https://github.com/scipy/scipy/issues/16308 in CI — committed to Sums-of-Products/sumu by jussiviinikka 9 months ago
- Trying to fix https://github.com/scipy/scipy/issues/16308 in CI — committed to Sums-of-Products/sumu by jussiviinikka 9 months ago
- Trying to fix https://github.com/scipy/scipy/issues/16308 in CI — committed to Sums-of-Products/sumu by jussiviinikka 9 months ago
- Trying to fix https://github.com/scipy/scipy/issues/16308 in CI — committed to Sums-of-Products/sumu by jussiviinikka 9 months ago
- Trying to fix https://github.com/scipy/scipy/issues/16308 in CI — committed to Sums-of-Products/sumu by jussiviinikka 9 months ago
- Trying to fix https://github.com/scipy/scipy/issues/16308 in CI — committed to Sums-of-Products/sumu by jussiviinikka 9 months ago
I had the same issue as @oscarbenjamin, only on my Mac m1. Here my simple solution for Macos users:
Ensure you have installed Openblas if not
brew install openblas
Then type
brew info openblas
. Check the output lines:you may have other outputs.
But also this is one of the items at #16293 and the goal is to teach Meson some of these fallback detection methods. 😃
I think we have now gotten to the point where this issue is no longer helpful - too long and too many different errors being mixed in. We have docs at ~http://scipy.github.io/devdocs/dev/contributor/meson_advanced.html#select-a-different-blas-or-lapack-library~ http://scipy.github.io/devdocs/building/blas_lapack.html on how to switch to different BLAS/LAPACK libraries, and for new issues it’d be better if folks opened new issues. So I’ll close this. Thanks everyone!
As a datapoint, I was helping a user of a downstream package the other day, and he was having a bunch of incompehensible errors pointing at pkg-config. After several iterations, it turned out all these disappeared once he installed python and pkg-config inside of a conda env. This might be specific to macOS / anaconda combo though.
Mixing conda- and homebrew-installed bits seems to be brittle.
@lucascolley , thanks 🙏 that really helped
@rgommers, I added my own openblas.pc based on your template sample, set the PKG_CONFIG_PATH, and was able to build scipy successfully - and got my TVM build and install complete as well. Thank you for the assist!
The CMake version “shouldn’t” matter. Installing a newer one from pip is a waste of time, but shouldn’t make things worse. (Hopefully. It may lack correct system integration.)
There’s no such thing as a pip version of pkg-config. But there is a python module that is a set of thin python functions that run the system pkg-config, translating a python function-y interface into a set of arguments to subprocess.run, then parse the returned output into python lists.
Neither meson nor SciPy uses that, so you can ignore that this wrapper module exists.
…
What matters is if the openblas RHEL package ships with the upstream openblas cmake files. Unfortunately, it doesn’t – for the same reason it doesn’t ship with the upstream openblas pkg-config file.
As @rgommers said, you can write your own – or download openblas yourself and install it by hand, I guess.
Unfortunately there’s nothing to do other than to submit a bug report to RHEL, they broke the upstream software.
That page itself shouldn’t have instructions for building from source, however it does need to link to the correct pages in our developer docs. I’ll fix that.
Yes, that is likely to lead to problems. There should never be a need to do this. I guess even considering that is a carry-over of bad habits forced on us by PyPI being so incomplete.
@rgommers
Here’s the result:
BTW, I found Fedora decided not to ship openblas.pc https://bugzilla.redhat.com/show_bug.cgi?id=1574517
Here’s the discussion in another thread in case you are not aware of: https://github.com/scipy/scipy/pull/16750
gh-16750 improves the fallback detection. I’ve tested that indeed
pkg-config
gets tried first, and CMake second.Okay, I edited the title since I guess the Python version is not relevant and maybe numpy isn’t either…
Great, thanks Oscar!
I’m expecting the same question a bunch more times, so let’s leave this open for now so the issue and solution are more discoverable.