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

Pin dependency to NumPy 1.x #993

Closed

Conversation

kta-intel
Copy link
Collaborator

This PR:

  • Pins setup.py install_requires to numpy>2

Background: NumPy recently had a major release (v2.0.0) that has some potential downstream issues with packages compiled for NumPy 1.x

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.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.

source

Issue: This impacts at least PyTorch versions earlier than v2.3 (i.e. PyTorch Task Runner)

>>> torch.__version__
'2.2.2+cpu'
>>> x = torch.rand(1)
>>> x.numpy()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Numpy is not available

Proposed resolution: Pin install requirement to numpy<2
Rationale: With python v3.9+ installing OpenFL will automatically install NumPy 2.0.0. By pinning to NumPy 1.x, this will allow OpenFL to continue to support earlier versions of PyTorch as well as avoid any potential issues caused in other packages.

Another potential resolution would be to update all PyTorch examples and workspaces to 2.3.0+, but older torch versions might not work, and we might not catch other potential downstream issues.

Signed-off-by: kta-intel <[email protected]>
@kta-intel kta-intel force-pushed the kta-intel/fix-numpy branch from 0e8d5f6 to bf13c04 Compare June 23, 2024 20:47
@kta-intel
Copy link
Collaborator Author

Pinning to numpy<2 will likely result in issues down the line as dependencies are compiled for Numpy 2.x
A better resolution would be to update the workspaces to the latest packages as needed
New PR: #1000

@kta-intel kta-intel closed this Jul 9, 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

Successfully merging this pull request may close these issues.

1 participant