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

allow numpy 2 #393

Closed
wants to merge 2 commits into from
Closed

Conversation

AdamOrmondroyd
Copy link
Collaborator

@AdamOrmondroyd AdamOrmondroyd commented Sep 2, 2024

Description

I think pytables has finally caught up as of about 2 weeks ago. PyTables/PyTables@db6224b

Looks like fastkde isn't updated?

Fixes # (issue)

Checklist:

  • I have performed a self-review of my own code
  • My code is PEP8 compliant (flake8 anesthetic tests)
  • My code contains compliant docstrings (pydocstyle --convention=numpy anesthetic)
  • New and existing unit tests pass locally with my changes (python -m pytest)
  • I have added tests that prove my fix is effective or that my feature works
  • I have appropriately incremented the semantic version number in both README.rst and anesthetic/_version.py

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d367a4b) to head (7fc080f).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #393   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           36        36           
  Lines         3058      3058           
=========================================
  Hits          3058      3058           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AdamOrmondroyd
Copy link
Collaborator Author

AdamOrmondroyd commented Sep 3, 2024

There's a strange quirk here. The pytests pass, but skipping more than usual. This is because fastkde was built with numpy 1, so import anesthetic.kde gives:

>>> import anesthetic.kde

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.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/adam/phd/anesthetic/anesthetic/kde.py", line 7, in <module>
    from fastkde import fastKDE
  File "/Users/adam/phd/env_pc/lib/python3.12/site-packages/fastkde/__init__.py", line 10, in <module>
    import fastkde.fastKDE
  File "/Users/adam/phd/env_pc/lib/python3.12/site-packages/fastkde/fastKDE.py", line 5, in <module>
    import fastkde.empiricalCharacteristicFunction as ecf
  File "/Users/adam/phd/env_pc/lib/python3.12/site-packages/fastkde/empiricalCharacteristicFunction.py", line 3, in <module>
    import fastkde.nufft as nufft
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/adam/phd/anesthetic/anesthetic/kde.py", line 7, in <module>
    from fastkde import fastKDE
  File "/Users/adam/phd/env_pc/lib/python3.12/site-packages/fastkde/__init__.py", line 10, in <module>
    import fastkde.fastKDE
  File "/Users/adam/phd/env_pc/lib/python3.12/site-packages/fastkde/fastKDE.py", line 5, in <module>
    import fastkde.empiricalCharacteristicFunction as ecf
  File "/Users/adam/phd/env_pc/lib/python3.12/site-packages/fastkde/empiricalCharacteristicFunction.py", line 3, in <module>
    import fastkde.nufft as nufft
  File "nufft.pyx", line 1, in init fastkde.nufft
ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use '<void>numpy._import_array' to disable if you are certain you don't need it).

Perhaps this is a flaw in our failed import-based test-skipping strategy, as I might have missed this if the docs hadn't also failed!

@AdamOrmondroyd
Copy link
Collaborator Author

AdamOrmondroyd commented Sep 10, 2024

I've fixed fastkde LBL-EESA/fastkde#44, though the owner was so quick to merge they didn't increment the version number!

Not sure when this will end up on pypi, but tests are passing (and running!) and docs are building locally

@AdamOrmondroyd
Copy link
Collaborator Author

No idea how I forgot that I'd already opened #388, apologies. Will close this one

@AdamOrmondroyd AdamOrmondroyd deleted the tables branch September 18, 2024 08:21
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.

1 participant