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

Remove numpy pin #332

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

glatterf42
Copy link
Contributor

Gurobipy v11.0.3 was released on July 16 and seems to be compatible with numpy >= 2.0.0. At least locally, running the tests via pytest . and an editable install from this branch with numpy 2.0.1 and gurobipy 11.0.3, all tests are passing :)

The only thing I can't quite make sense of is this warning:

test/test_io.py::test_model_to_netcdf
  <frozen importlib._bootstrap>:488: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility. Expected 16 from C header, got 96 from PyObject

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.98%. Comparing base (4735725) to head (e848cf1).
Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #332      +/-   ##
==========================================
- Coverage   86.00%   84.98%   -1.03%     
==========================================
  Files          17       17              
  Lines        4209     4209              
  Branches      989      989              
==========================================
- Hits         3620     3577      -43     
- Misses        430      473      +43     
  Partials      159      159              

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

@lkstrp
Copy link
Member

lkstrp commented Jul 24, 2024

Some tests on Windows also fail. This is not urgent, but feel free to dig in.
Numpy deprecation with NPY201 is already being applied.

@glatterf42
Copy link
Contributor Author

Not what I expected, and I'm not using Windows. Comparing the latest py3.12 runs on Windows and Ubuntu, the only difference in the packages I notice is colorama 0.4.6 being installed on Windows, but I don't think that's the issue.
Comparing to the successful Windows latest py3.10 run, the version of numpy differs. Numpy 2.0.1 is only used on Python 3.11 or greater, it seems.

My guess is that there's some kind of incompatibility with numpy still, but I'm struggling to troubleshoot this since 2.0.1 works fine on Ubuntu and Macos. The only differences in the workflows I notice are the Install <OS> dependency steps and those are very difficult to compare. Apart from that, the python version, package version, etc, are all identical.
Looking at the traceback, the only package involved seems to be polars and they do actually have an open issue with the title sounding very similar to the error here: pola-rs/polars#16863
Unfortunately, I'm not sure if this is all that useful. The proposed solution is to not used concat() in favor of a little refactoring, but I'm not sure you can apply the same here.
As far as I can tell from quickly looking at polar's source, I can't find a special treatment of Windows for the functions that seem to cause the error.

Happy to help further, but I'm slowly running out of ideas. Maybe it's still best to hold off on removing the numpy pin for now and hope the responsible party releases a fix soon.
Just a bit inconvenient for my special case: I only want to use Highs with linopy (for now), which works well with numpy 2.x, as does our side of packages, so my solution for now is to use my own branch which already allows numpy 2.x and just be aware that gurobipy can't be used with that (and that I'm anyway not on Windows, it seems).

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.

2 participants