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

numpy v2 and requirements.txt #1566

Open
petrelharp opened this issue Jul 5, 2024 · 1 comment
Open

numpy v2 and requirements.txt #1566

petrelharp opened this issue Jul 5, 2024 · 1 comment

Comments

@petrelharp
Copy link
Contributor

petrelharp commented Jul 5, 2024

Right now, installing requirements/development.txt gets

>>> import stdpopsim

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 "/home/peter/projects/popsim-consortium/stdpopsim/stdpopsim/__init__.py", line 12, in <module>
    from .genetic_maps import *  # NOQA
  File "/home/peter/projects/popsim-consortium/stdpopsim/stdpopsim/genetic_maps.py", line 6, in <module>
    import msprime
  File "/home/peter/micromamba/envs/stdpopsim/lib/python3.12/site-packages/msprime/__init__.py", line 28, in <module>
    from msprime._msprime import (
Traceback (most recent call last):
  File "/home/peter/micromamba/envs/stdpopsim/lib/python3.12/site-packages/numpy/core/_multiarray_umath.py", line 44, in __getattr__
    raise ImportError(msg)
ImportError: 
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 "/home/peter/projects/popsim-consortium/stdpopsim/stdpopsim/__init__.py", line 12, in <module>
    from .genetic_maps import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/projects/popsim-consortium/stdpopsim/stdpopsim/genetic_maps.py", line 6, in <module>
    import msprime
  File "/home/peter/micromamba/envs/stdpopsim/lib/python3.12/site-packages/msprime/__init__.py", line 28, in <module>
    from msprime._msprime import (
ImportError: numpy.core.multiarray failed to import

Currently, tskit pins to numpy<2 in requirements/development.txt; however, not in the conda prereqs -- I'm confused.

@petrelharp
Copy link
Contributor Author

We shouldn't need to do anything for this once this is fixed upstream: tskit-dev/msprime#2287

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

No branches or pull requests

1 participant