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 2.0 release breaks Pandas functionality #326

Closed
jmahrens opened this issue Jun 27, 2024 · 3 comments · Fixed by #356
Closed

Numpy 2.0 release breaks Pandas functionality #326

jmahrens opened this issue Jun 27, 2024 · 3 comments · Fixed by #356
Assignees
Milestone

Comments

@jmahrens
Copy link

🐛 Summary

New installation of the python requirements breaks Pandas binary check due to Numpy releasing 2.0 on June 16th 2024 - https://pypi.org/project/numpy/#history

macOS 14.5 - M3 Pro

To reproduce

  1. Within a virtual envrionment, run "python3 -m pip install" as directed in the README.md
  2. Run "scubagoggles gws --omitsudo"

Expected behavior

Program will open a browser window to authorize OAuth token

Problem Output

(.venv) user@macOS scubagoggles-0.2.0 % scubagoggles gws --omitsude
Traceback (most recent call last):
  File "/Users/user/scuba/.venv/bin/scubagoggles", line 5, in <module>
    from scubagoggles.main import dive
  File "/Users/user/scuba/.venv/lib/python3.12/site-packages/scubagoggles/main.py", line 9, in <module>
    from scubagoggles.orchestrator import gws_products, start_automation
  File "/Users/user/scuba/.venv/lib/python3.12/site-packages/scubagoggles/orchestrator.py", line 17, in <module>
    from scubagoggles.reporter import reporter, md_parser
  File "/Users/user/scuba/.venv/lib/python3.12/site-packages/scubagoggles/reporter/reporter.py", line 10, in <module>
    import pandas as pd
  File "/Users/user/scuba/.venv/lib/python3.12/site-packages/pandas/__init__.py", line 22, in <module>
    from pandas.compat import is_numpy_dev as _is_numpy_dev  # pyright: ignore # noqa:F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/scuba/.venv/lib/python3.12/site-packages/pandas/compat/__init__.py", line 18, in <module>
    from pandas.compat.numpy import (
  File "/Users/user/scuba/.venv/lib/python3.12/site-packages/pandas/compat/numpy/__init__.py", line 4, in <module>
    from pandas.util.version import Version
  File "/Users/user/scuba/.venv/lib/python3.12/site-packages/pandas/util/__init__.py", line 2, in <module>
    from pandas.util._decorators import (  # noqa:F401
  File "/Users/user/scuba/.venv/lib/python3.12/site-packages/pandas/util/_decorators.py", line 14, in <module>
    from pandas._libs.properties import cache_readonly
  File "/Users/user/scuba/.venv/lib/python3.12/site-packages/pandas/_libs/__init__.py", line 13, in <module>
    from pandas._libs.interval import Interval
  File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Temporary Fix

(.venv) user@macOS scubagoggles-0.2.0 % pip show numpy
Name: numpy
Version: 2.0.0

~SNIP~

(.venv) user@macOS scubagoggles-0.2.0 % pip uninstall numpy
Found existing installation: numpy 2.0.0
Uninstalling numpy-2.0.0:
  Would remove:
    /Users/user/scuba/.venv/bin/f2py
    /Users/user/scuba/.venv/bin/numpy-config
    /Users/user/scuba/.venv/lib/python3.12/site-packages/numpy-2.0.0.dist-info/*
    /Users/user/scuba/.venv/lib/python3.12/site-packages/numpy/*
Proceed (Y/n)? y
  Successfully uninstalled numpy-2.0.0

(.venv) user@macOS scubagoggles-0.2.0 % pip install numpy==1.26.4
Collecting numpy==1.26.4
  Downloading numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl.metadata (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.1/61.1 kB 6.3 MB/s eta 0:00:00
Downloading numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl (13.7 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.7/13.7 MB 57.2 MB/s eta 0:00:00
Installing collected packages: numpy
Successfully installed numpy-1.26.4

(.venv) user@macOS scubagoggles-0.2.0 % scubagoggles gws --omitsudo
Please visit this URL to authorize this application: https://accounts.google.com/o/oauth2/auth?response_type...
~SNIP~
@mitchelbaker-cisa
Copy link
Collaborator

Adding a note that pinning the numpy to v1.26.4 requires Python >= 3.9 or higher.

Tried running our smoke testing with Python v3.8.4 and getting errors:
https://github.com/cisagov/ScubaGoggles/actions/runs/10203218514/job/28229049891

@aormu
Copy link
Collaborator

aormu commented Aug 15, 2024

This ticket is tied to #321. Minimum version of numPy is 1.26.0 and pandas 1.5.0 for Python 3.9. Note that newer version of pandas 2.x is not compatible with Python 3.9.

@aormu aormu self-assigned this Aug 15, 2024
@adhilto adhilto added this to the Coast milestone Aug 20, 2024
@aormu
Copy link
Collaborator

aormu commented Aug 21, 2024

This ticket is related to #321 Python version. Python 3.10 supports NumPy 2.0.

setup.py and requirements.txt are updated to include Pandas 2.0.0 which is compatible with NumPy 2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment