label-studio-sdk icon indicating copy to clipboard operation
label-studio-sdk copied to clipboard

Numpy version dependency

Open nic-elia opened this issue 1 year ago • 9 comments

Hi,

would it be possible to adjust the poetry dependency jsonschema = "<2.0.0" in pyproject.toml to support Numpy v2 and achieve better compatibility with other packages?

Thanks!

nic-elia avatar Aug 28 '24 11:08 nic-elia

@farioas I would also like to see numpy 2 support for an improved integration with Voxel51 and other tools in the same project.

daniel-bogdoll avatar Dec 11 '24 15:12 daniel-bogdoll

Any progress on this? This package is getting rather useless if it does not support numpy 2. Are you guys focusing more on paid services?

paapu88 avatar Dec 23 '24 15:12 paapu88

We going to support numpy 2 in the next releases. The recommended way for LS runs is to use docker and python environments, therefore old numpy versions shouldn't be a problem.

makseq avatar Dec 23 '24 15:12 makseq

@makseq Thanks for pointing that out, had forgotten, apologies.

paapu88 avatar Dec 23 '24 16:12 paapu88

Would also love to see that numpy>=2.0.0 is supported!

pirnerjonas avatar Jan 09 '25 13:01 pirnerjonas

We are also integrating the sdk in one of our tools, and it would be nice to support >=2.0.0. Thanks!

francescowurq avatar Feb 13 '25 20:02 francescowurq

Any updates when / in which release we can expect this @makseq?

pirnerjonas avatar Feb 27 '25 12:02 pirnerjonas

Same here. Would be great to have support for numpy>2

mjunker avatar Feb 28 '25 09:02 mjunker

+1 on this please

Alex-ley-scrub avatar Mar 16 '25 14:03 Alex-ley-scrub

@makseq I am not sure exactly what you mean by using Label Studio runs via Docker or Python environments - we use Docker in our product and we use Python environments (using pixi which wraps conda and uv) - but this doesn't solve the problem for us, which is that our dependency on the Label Studio SDK to work with our Label Studio server means that our whole app now has to use NumPy 1.x. We could use a separate process and a separate container for our communication with Label Studio and Inter-Process Communication (IPC), but this would significantly over-complicate things for us.

I have opened a Pull Request #436 to upgrade NumPy to 2.0, so unless you have some reason that you know that the Label Studio SDK cannot support NumPy 2.0, (in which case I would be glad to know what and see if I can contribute a fix), I would be happy if you can merge it 🙏

benglewis avatar Apr 08 '25 12:04 benglewis

I just changed depency in line 45 pyproject.toml to numpy = ">=2.0.0,<3.0.0"

7 tests failed, but not sure does that have to do with numpy 2

=========================== short test summary info ============================ ERROR tests/test_refresh_token.py::test_refresh_token_auth ERROR tests/test_refresh_token.py::test_initial_request_triggers_token_refresh ERROR tests/test_refresh_token.py::test_expired_token_triggers_refresh ERROR tests/test_refresh_token.py::test_valid_token_skips_refresh ERROR tests/test_refresh_token.py::test_legacy_token_detection ERROR tests/test_refresh_token.py::test_async_legacy_token_detection ERROR tests/test_refresh_token.py::test_async_jwt_refresh_token ========== 166 passed, 201 skipped, 329 warnings, 7 errors in 18.33s ===========

paapu88 avatar Apr 08 '25 14:04 paapu88

Thank you for the contribution @benglewis ! I'm not sure what's going on with CI on your branch, but it seems to be failing. I made #439 with the intention of debugging, but it seems to work there. I'll see if we can get this working on your branch tomorrow so we can give you credit for your contribution. I also added numpy 2.0 to the test matrix, and it seems to be passing, so I'd expect that there shouldn't be any issues with running the sdk in a numpy 2.0 environment 👍

Would you mind me committing the CI changes to your branch, as well as relaxing the version pin?

pakelley avatar Apr 09 '25 01:04 pakelley

@paapu88 I haven't been able to reproduce the test failures you're seeing though, from what I can tell tests are passing with numpy 2.0. I'm curious: how are you running the tests? Those tests were added a month ago, so my suspicion is that your env is slightly out-of date

pakelley avatar Apr 09 '25 01:04 pakelley

@pakelley I'd be happy to to apply any required changes to my branch 🙌

From what I can see the tests are failing in CI due to POETRY_VERSION not being defined since the value is defined as a repository variable since GitHub Actions doesn't allow external contributors code changes to access internal variables in workflows from what I understand (I know that it blocks secret access so this isn't surprising). Hopefully if you add changes to my PR, it should it allow access to the variable, but I'm not 100% sure

benglewis avatar Apr 09 '25 05:04 benglewis

@pakelley I probably did this (yesterday):

  1. cd ~/gitlab/OtherPeople; git clone https://github.com/HumanSignal/label-studio-sdk.git
  2. made one line numpy version change to pyproject.toml
  3. did set a virtual env by python -m venv ~/venvs/labels and source ~/venvs/labels/bin/activate
  4. cd ~/gitlab/OtherPeople/label-studio-sdk; pip install -e ".[dev]"; pip install pytest
  5. pytest

paapu88 avatar Apr 09 '25 07:04 paapu88

@pakelley It looks like the issue was probably that I didn't have the POETRY_VERSION defined in my fork's GitHub Actions variables. I have added that with the same version as here and it now looks like it will work AFAIK (I just opened a PR to main on my fork and it looks like it worked fine). I think that given the large number of comments here and other also affected, it would be nice if we can merge this :)

benglewis avatar Apr 15 '25 09:04 benglewis

Hey there, sorry for dropping the ball here, would you mind changing your pin so that we don't exclude numpy 1 users? I'd like to support both and avoid breaking anyone's existing envs. I figure making the pin something like ">=1.26.4,<3.0.0" should work. Once that's done I'm happy to approve! Thank you for the contribution and your persistence here 🙂

pakelley avatar Apr 16 '25 21:04 pakelley

This is merged, the SDK now (finally) supports numpy 2 🎊

pakelley avatar Apr 23 '25 15:04 pakelley

Hi @nic-elia! Could you please email me regarding this issue? [email protected] . Thanks!

micaelakaplan avatar May 01 '25 17:05 micaelakaplan