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

Hybrid solver broken for numpy 2.0+ #187

Closed
shalabs opened this issue Jul 22, 2024 · 2 comments
Closed

Hybrid solver broken for numpy 2.0+ #187

shalabs opened this issue Jul 22, 2024 · 2 comments
Assignees

Comments

@shalabs
Copy link

shalabs commented Jul 22, 2024

Problem description

Hello,

I have installed the latest version of MICOM (through pip) and have been unsuccessful in importing it. Interestingly, after installing MICOM, importing Cobra by itself also yields the same error. Any help with this?

Code Sample

import micom
OSQP and HIGHS are available but could not load the hybrid interface.
Traceback (most recent call last):
  File "/Users/shahad/PycharmProjects/pythonProject/.venv/lib/python3.12/site-packages/optlang/__init__.py", line 61, in <module>
    from optlang import hybrid_interface
  File "/Users/shahad/PycharmProjects/pythonProject/.venv/lib/python3.12/site-packages/optlang/hybrid_interface.py", line 26, in <module>
    import optlang.matrix_interface as mi
  File "/Users/shahad/PycharmProjects/pythonProject/.venv/lib/python3.12/site-packages/optlang/matrix_interface.py", line 40, in <module>
    from numpy import Infinity, array, concatenate, zeros
ImportError: cannot import name 'Infinity' from 'numpy' (/Users/shahad/PycharmProjects/pythonProject/.venv/lib/python3.12/site-packages/numpy/__init__.py). Did you mean: 'isfinite'?
..

Process finished with exit code 0

Context

Python 3.12.3
micom 0.35.0
cobra 0.29
@cdiener
Copy link
Collaborator

cdiener commented Jul 22, 2024

It's an incompatibility with numpy 2.0. It's already fixed in opencobra/optlang#266 and there should be a new optlang release soon. For now, downgrading numpy to <2.0 should work.

@cdiener cdiener changed the title Possible incompatibility with HIGHS and OSQP? Hybrid solver broken for numpy 2.0+ Jul 22, 2024
@cdiener cdiener self-assigned this Jul 22, 2024
@cdiener
Copy link
Collaborator

cdiener commented Aug 6, 2024

Fixed in 0.36.3.

@cdiener cdiener closed this as completed Aug 6, 2024
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

2 participants