You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recent installations of apexpy in a clean environment appears to succeed, but then fails on import with the traditional fortranapex error.
UserWarning: fortranapex module could not be imported, so apexpy probably won't work.
Based on the traceback (provided below), the problem looks like it may be related to the recent release of numpy 2.0. When installing in a clean environment, pip will automatically try to install the latest version of the numpy as a dependency. If instead I manually install an older version of numpy BEFORE trying to install apexpy, everything works as expected and there are no problems.
pip install numpy==1.26.4
pip install apexpy
There is a numpy migration guide that will likely be useful in adapting apexpy to work with numpy 2.0.
To Reproduce
Create a fresh python environment (python 3.10 used here)
pip install apexpy
In python, import apexpy
Expected behavior
Apexpy should successfully install and be usable from pip.
Traceback
>>> from apexpy import Apex
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "<stdin>", line 1, in <module>
File "/Users/e30737/miniconda3/envs/py310_test/lib/python3.10/site-packages/apexpy/__init__.py", line 5, in <module>
from apexpy import fortranapex # noqa F401
AttributeError: _ARRAY_API not found
fortranapex module could not be imported. apexpy probably won't work. Failed with error: numpy.core.multiarray failed to import
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "<stdin>", line 1, in <module>
File "/Users/e30737/miniconda3/envs/py310_test/lib/python3.10/site-packages/apexpy/__init__.py", line 11, in <module>
from apexpy.apex import Apex, ApexHeightError # noqa F401
File "/Users/e30737/miniconda3/envs/py310_test/lib/python3.10/site-packages/apexpy/apex.py", line 13, in <module>
from apexpy import fortranapex as fa
AttributeError: _ARRAY_API not found
/Users/e30737/miniconda3/envs/py310_test/lib/python3.10/site-packages/apexpy/apex.py:15: UserWarning: fortranapex module could not be imported, so apexpy probably won't work. Make sure you have a gfortran compiler. Failed with error: numpy.core.multiarray failed to import
warnings.warn("".join(["fortranapex module could not be imported, so ",
Computer
OS: MacOS 14.2.1
Python version: 3.10
Compiler with version: gfortran 13.1
Apexpy version/branch: 2.0.1/main
The text was updated successfully, but these errors were encountered:
Came here because I also ran into this issue today. Until fixed, it's also possible to just uninstall numpy whilst apexpy is installed, and then reinstall the previous version before 2.0: pip uninstall numpy pip install numpy==1.26.4
Describe the bug
Recent installations of apexpy in a clean environment appears to succeed, but then fails on import with the traditional fortranapex error.
Based on the traceback (provided below), the problem looks like it may be related to the recent release of numpy 2.0. When installing in a clean environment, pip will automatically try to install the latest version of the numpy as a dependency. If instead I manually install an older version of numpy BEFORE trying to install apexpy, everything works as expected and there are no problems.
There is a numpy migration guide that will likely be useful in adapting apexpy to work with numpy 2.0.
To Reproduce
pip install apexpy
import apexpy
Expected behavior
Apexpy should successfully install and be usable from pip.
Traceback
Computer
The text was updated successfully, but these errors were encountered: