-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
Describe the bug
numpy.f2py.compile function has been removed since NumPy 2.0.0 (https://numpy.org/doc/stable/release/2.0.0-notes.html), causing the python/Fortran test code in psychrolib to fail. The following error message is displayed when executing "pytest -v -s"
ImportError while loading conftest '/workspaces/psychrolib/tests/conftest.py'.
tests/conftest.py:26: in <module>
f2py.compile(source , modulename='psychrolib_fortran', extension='.f90')
/usr/local/lib/python3.11/site-packages/numpy/f2py/__init__.py:82: in __getattr__
raise AttributeError("module {!r} has no attribute "
E AttributeError: module 'numpy.f2py' has no attribute 'compile'To Reproduce
Steps to reproduce the behavior:
- see Environment for the installed packages
- execute: python -m pytest -v -s
Environment:
- Docker container based on python:3.11-slim
- Installed python packages:
cffi 1.17.1
charset-normalizer 3.4.0
iniconfig 2.0.0
numpy 2.2.0
packaging 24.2
pip 24.0
pluggy 1.5.0
PsychroLib 2.5.0 /psychrolib/src/python
pycparser 2.22
pytest 8.3.4
setuptools 65.5.1
wheel 0.45.1
Additional comment
A possible workaround is to use subprocess.run to directly call f2py
Example:
import subprocess
PATH_TO_LIB = Path(__file__).parents[1] / 'src' / 'fortran' / 'psychrolib.f90'
subprocess.run(['f2py', '-c', '-m', 'psychrolib_fortran', str(PATH_TO_LIB)], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels