Closed jeroenbouwman closed 2 years ago
As a small update to this issue, badman version 2.4.8 with python 3.8.12 and numpy 1.20.3 works just fine on my system
eddit: I made more test installing batman on different systems as part of conda environment / my pypi package and the only option I found to ensure a correctly working version of batman if I specified a numpy version of 1.22.1, the latest version on conda-forge, so I assume the very latest release of numpy. It's weird that on my own system things seem to work also for other numpy versions but this is not guaranteed. Still it would be nice, if there is no strong reason for the functionality of batman, if older version of numpy (at least 1.20.3 and later) would be supported.
suggest changing 'numpy' to 'oldest-supported-numpy' in pyproject.toml
I encountered a very similar issue. I was trying to install batman in the same conda environment as theano which requires numpy<1.22 (since theano has been deprecated). When trying to import batman with numpy==1.21.5 or numpy==1.21.4, I end up with the following opaque error message which I believe is saying batman was compiled against numpy==1.22 but the current environment has numpy==1.21:
In [1]: import batman
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import batman
File ~/miniconda3/envs/eureka/lib/python3.9/site-packages/batman/__init__.py:6, in <module>
1 __all__ = ['transitmodel', 'tests', 'plots']
4 __version__ = "2.4.8"
----> 6 from .transitmodel import *
7 from .tests import *
8 from .plots import *
File ~/miniconda3/envs/eureka/lib/python3.9/site-packages/batman/transitmodel.py:18, in <module>
1 # The batman package: fast computation of exoplanet transit light curves
2 # Copyright (C) 2015 Laura Kreidberg
3 #
(...)
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 import numpy as np
---> 18 from . import _nonlinear_ld
19 from . import _quadratic_ld
20 from . import _uniform_ld
ImportError: numpy.core.multiarray failed to import
However, editing 'numpy' to 'oldest-supported-numpy' in batman's pyproject.toml file as @malynda had suggested and then doing a pip install .
worked like a charm and I can now import batman without any issues
I have encountered the same issue and was able to resolve it the same way.
Thanks all for proposing this solution.
@lkreidberg May I suggest that you modify the pyproject.toml
file and replace numpy
with oldest-supported-numpy
? Thank you.
Thanks for the suggestions and your patience, everyone!
I just updated the requirement to oldest-supported-numpy. Ugprade batman to version 2.4.9 for the latest.
In the future, please consider submitting a PR for changes like this - it will help me respond faster!
I think this issue might be related to issue to issue #50. I tried installing the badman package (2.4.8) from pip in a python 3.9.7 conda environment. The problem is that batman only works with numpy version 1.22.1, which is only available on conda-forge not in the regular channel. This is problematic as this breaks several other packages used in combination with batman. The problem are the compiled functions like _nonlinear_ld which depend on a certain numpy version. Falling back to a earlier version of numpy results in an "ImportError: numpy.core.multiarray failed to import" error . If there is no particular reason to use this numpy version could there be pypi wheels for numpy version 1.20.3?
I think the same problem occurs for batman version 2.4.6, where I also had to downgrade setuptools to 52.0.0 to get the install to work.