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

trapz deprecated in scipy and healpy #20

Open
jrfarah opened this issue Jul 22, 2024 · 1 comment
Open

trapz deprecated in scipy and healpy #20

jrfarah opened this issue Jul 22, 2024 · 1 comment
Assignees
Labels
bug Something isn't working dependencies Pull requests that update a dependency file

Comments

@jrfarah
Copy link
Collaborator

jrfarah commented Jul 22, 2024

Attempting to build snex2 on bare metal (from the branch feature/add_hermes_tns_sharing) succeeds but running throws the following error:

Traceback (most recent call last):
  File "/Users/josephfarah/Documents/phd/snex2/snex2_baremetal/snex2/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/django/apps/registry.py", line 124, in populate
    app_config.ready()
  File "/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/tom_nonlocalizedevents/apps.py", line 8, in ready
    import tom_nonlocalizedevents.signals.handlers  # noqa
  File "/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/tom_nonlocalizedevents/signals/handlers.py", line 8, in <module>
    from tom_nonlocalizedevents.healpix_utils import update_all_credible_region_percents_for_candidates
  File "/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/tom_nonlocalizedevents/healpix_utils.py", line 18, in <module>
    from ligo.skymap import distance
  File "/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/ligo/skymap/distance.py", line 38, in <module>
    import healpy as hp
  File "/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/healpy/__init__.py", line 67, in <module>
    from .sphtfunc import (
  File "/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/healpy/sphtfunc.py", line 27, in <module>
    from scipy.integrate import trapz
ImportError: cannot import name 'trapz' from 'scipy.integrate' (/Users/josephfarah/miniconda3/envs/snex2/lib/python3.10/site-packages/scipy/integrate/__init__.py)

The problem is originating in healpy, as scipy has moved from scipy.integrate.trapz to scipy.integrate.trapezoid for the method call. I did some investigation and discovered that this was fixed in a very recent version of healpy last month. The commit can be found here:

healpy/healpy@9319707

Commit message:

Rename trapz function from scipy.integrate module to trapezoid

However, it seems like some package in snex2 is enforcing an older version of healpy. I was able to get around the issue by enforcing the install of healpy-1.17.3 (last week's version, which for some reason is not installed with pip install healpy by default); however I don't know how this will interact with the other snex2 dependencies.

@cmccully @crpellegrino @jnation3406 I'm happy to open a PR updating the requirements.txt with this fix, if this is the best way to address the issue.

@jrfarah jrfarah self-assigned this Jul 22, 2024
@jrfarah jrfarah added bug Something isn't working dependencies Pull requests that update a dependency file labels Jul 22, 2024
@moira-andrews
Copy link

I ran into this problem as well, was fixed with the solution proposed (specifically the healpy-1.17.3 installation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants