Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FindPython, and improve GHA to use venv #985

Merged
merged 2 commits into from Jan 29, 2022

Conversation

KrisThielemans
Copy link
Collaborator

@KrisThielemans KrisThielemans commented Jan 25, 2022

Fixes #979
(but not just yet)

@KrisThielemans
Copy link
Collaborator Author

I think the underlying problem was actually that CMake found a different Python library from the one that was used at run-time. I've therefore now switched to FindPython. But now I get a different error (sigh)

  File "/usr/local/lib/python3.9/site-packages/numpy/__init__.py", line 380, in <module>
    raise RuntimeError(msg)
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend.
If you compiled yourself, more information is available at:
https://numpy.org/doc/stable/user/building.html#accelerated-blas-lapack-libraries
Otherwise report this to the vendor that provided NumPy.

Some related info on this error:
https://trac-test.macports.org/ticket/61490 and
numpy/numpy#20418. Those say that the error went away, but here it is again...

@KrisThielemans
Copy link
Collaborator Author

numpy/numpy#15947 (comment) says to rebuild numpy make sure it doesn't use Accelerate but OpenBLAS. oh well

@KrisThielemans
Copy link
Collaborator Author

I can't rebuild numpy. I tried

python3 -m pip install --no-cache-dir --no-binary numpy numpy

and now get

RuntimeError: Setuptools version is '60.5.0', version < '60.0.0' is required. See pyproject.toml

@robbietuk maybe you can give some advice on how turn on MacOS these days

@KrisThielemans
Copy link
Collaborator Author

the latter is mentioned at numpy/numpy#20824

@robbietuk
Copy link
Collaborator

As mentioned here: (numpy/numpy#20824 (comment)), you may want to try a venv?

@KrisThielemans
Copy link
Collaborator Author

so... i think I have finally created the virtualenv correctly. python -c 'import numpy; print(numpy.pi); import numpy.core.multiarray works, but pytest still fails with the Polyfit sanity test. https://github.com/UCL/STIR/runs/4977297464?check_suite_focus=true#step:11:74

Looks like I have to try with rebuilding numpy anyway.

madness

@KrisThielemans
Copy link
Collaborator Author

rebuilding numpy didn't help

@KrisThielemans
Copy link
Collaborator Author

I've cleaned-up the history and squashed all the GHA commits.

@KrisThielemans
Copy link
Collaborator Author

I tried one more time with MacOS with some extra printout of Python libraries

.... Python_LIBRARIES: /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib
.... Python_INCLUDE_DIRS: /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9
.... Python_NumPy_INCLUDE_DIRS: /Users/runner/work/STIR/STIR/my-env/lib/python3.9/site-packages/numpy/core/include

This looks all perfectly fine, So I have no idea what's going on.

I'll disable the MacOS Python check and merge.

@KrisThielemans KrisThielemans changed the title fix GHA MacOS pip numpy problem Use FindPython, and improve GHA to use venv Jan 29, 2022
@KrisThielemans KrisThielemans merged commit 4e016d6 into UCL:master Jan 29, 2022
@KrisThielemans KrisThielemans deleted the fix_GHA_OSX_numpy branch January 29, 2022 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GHA: MacOS failure to import numpy
2 participants