nutonomy / nuscenes-devkit

The devkit of the nuScenes dataset.
https://www.nuScenes.org
Other
2.3k stars 630 forks source link

Prevent numpy >= 2.0.0 #1117

Closed michael-hoss closed 1 month ago

michael-hoss commented 1 month ago

numpy 2.0.0 comes with some bigger changes that I think the nuscenes-devkit is not prepared for (there are even problems for larger minor versions within numpy 1 https://github.com/nutonomy/nuscenes-devkit/issues/1055)

So I believe, the best we can do right now to enable a smooth installation of requirements is to at least prevent numpy 2

whyekit-motional commented 1 month ago

Thanks for this PR @michael-hoss!

Could you describe some examples where numpy 2.x is not playing nice with nuscenes-devkit?

michael-hoss commented 1 month ago

Thanks for this PR @michael-hoss!

Could you describe some examples where numpy 2.x is not playing nice with nuscenes-devkit?

Thanks for approving @whyekit-motional!

My issue was the following: I have nuscenes-devkit as a submodule in my own repo. In my own requirements.txt, I also install the devkit's requirements.txt: https://github.com/michael-hoss/perceptest/blob/af209e70e8c0261cb0034a85ed98494a567c2a63/requirements.txt#L5

In a CI unit test that I ran last week, apparently there was a compatibility issue with matplotlib:

https://github.com/michael-hoss/perceptest/actions/runs/11070925233/job/30761621502#step:7:98

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

Note that I do use Python 3.10. In the older Python versions that the nuscenes-devkit officially supports, it might install numpy<2 automatically.