Git Product home page Git Product logo

Comments (11)

rflamary avatar rflamary commented on July 17, 2024 2

We discussed with @cedricvincentcuaz and we want a release by the end of the month but next week should be doable. It is OK to push us it means that people need the toolbox ;). I wanted to do a release anyways and this numpy2 stuff is definitely a problem.

from pot.

rflamary avatar rflamary commented on July 17, 2024 1

damnit you are right. No worry we will build wheel independently of jax or tensorflow (they depend only on numpy) but indeed we will indedd need to rework the tests also....

from pot.

rflamary avatar rflamary commented on July 17, 2024 1

hum i think this is because of the use of oldest_suported_numpy that build using older numpy:

POT/setup.py

Line 72 in cba9c7b

setup_requires=["oldest-supported-numpy", "cython>=0.23"],

from pot.

rflamary avatar rflamary commented on July 17, 2024 1

OK we will have a look but feel free to do a PR in the meantime (it should be changed in the toml and setup.py files I think). This might be an easier fix than expected

from pot.

matthewfeickert avatar matthewfeickert commented on July 17, 2024

As NumPy v2.0 is out now, this would be a great boon to have. Are there particular technical issues with getting a new build out that need resolving? Or is this more a matter of (understandably) limited developer time at the moment?

from pot.

rflamary avatar rflamary commented on July 17, 2024

It is more a question of limited time ;). Actually I would expect POT to work on numpy 2.0 if build from source.

The idea is toccheck that all tests pass on numpy 2.0 and update the build wheel github action to run with two different versions of numpy. Then I guess we can do a proper release

from pot.

matthewfeickert avatar matthewfeickert commented on July 17, 2024

The idea is to check that all tests pass on numpy 2.0

@rflamary This becomes an understandably difficult problem though, as in the tests you are also testing in an environment with torch, jax, and tensorflow.

POT/requirements.txt

Lines 8 to 11 in cba9c7b

torch
jax<=0.4.24
jaxlib<=0.4.24
tensorflow

The PyTorch and JAX (via ml-dtypes) teams already got NumPy 2.0 compatible wheels out, but as of 2024-06-18 TensorFlow does not. As POT tests against all these libraries, does that mean that POT doesn't plan to support NumPy 2.0 untl TensorFlow does (which might be weeks to months later)? If that is the plan, is it possible to run on a subset of your tests with NumPy 2.0 compatible dependencies to determine if things are functioning as expected, and then release wheels built to support NumPy?

from pot.

matthewfeickert avatar matthewfeickert commented on July 17, 2024

Actually I would expect POT to work on numpy 2.0 if build from source.

Unfortunately, not from the v0.9.3 sdist:

# docker run --rm -ti python:3.12 /bin/bash
$ python -m pip --quiet install --upgrade uv
$ uv venv && . .venv/bin/activate
$ uv pip install --upgrade 'numpy>=2.0.0'
$ uv pip install --no-binary pot pot
Resolved 3 packages in 582ms
   Built pot==0.9.3
Downloaded 2 packages in 8.31s
Installed 2 packages in 18ms
 + pot==0.9.3
 + scipy==1.13.1
$ uv pip list
Package Version
------- -------
numpy   2.0.0
pot     0.9.3
scipy   1.13.1
$ python -c 'import ot'

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.

Traceback (most recent call last):  File "<string>", line 1, in <module>
  File "/.venv/lib/python3.12/site-packages/ot/__init__.py", line 21, in <module>
    from . import lp
  File "/.venv/lib/python3.12/site-packages/ot/lp/__init__.py", line 23, in <module>
    from .emd_wrap import emd_c, check_result, emd_1d_sorted
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/.venv/lib/python3.12/site-packages/ot/__init__.py", line 21, in <module>
    from . import lp
  File "/.venv/lib/python3.12/site-packages/ot/lp/__init__.py", line 23, in <module>
    from .emd_wrap import emd_c, check_result, emd_1d_sorted
  File "ot/lp/emd_wrap.pyx", line 1, in init ot.lp.emd_wrap
ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use '<void>numpy._import_array' to disable if you are certain you don't need it).

from pot.

matthewfeickert avatar matthewfeickert commented on July 17, 2024

Yeah, to be clear I am no expert here, but from quickly reading bits of the "For downstream package authors" NumPy guide (the NumPy 2.0-specific advice), I think oldest-supported-numpy in

requires = ["setuptools", "wheel", "oldest-supported-numpy", "cython>=0.23"]

needs to get swapped for "numpy>=2.0.0" to build wheels compatible with both NumPy 1.xx and 2.x. Though I haven't tested that.

from pot.

matthewfeickert avatar matthewfeickert commented on July 17, 2024

@rflamary @cedricvincentcuaz I haven't stepped through the changes from v0.9.3 to the current state of master (0.9.3...36b4c0a) enough to know if a patch or minor release would be more appropriate, but once PR #630 is in, would it be possible to get a new release with the NumPy 2.0 compatible wheels? I'm not trying to be pushy and I don't want to come across as demanding of your time, so I don't want to ask you to commit to a timeline, I am more just wondering if you think that this would be something that could be done in the near future (~ next week timeline), and if not (understandable as we're all busy) if you have a rough idea of when that might be.

from pot.

matthewfeickert avatar matthewfeickert commented on July 17, 2024

we want a release by the end of the month but next week should be doable

That sounds great! End of month is already soon, so that would be excellent. I'm asking as the student I'm supervising would like to make a release of a library soon, but before or around the start of July 2024 is fine. 👍 Thanks!

from pot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.