dmlc / dgl

Python package built to ease deep learning on graph, on top of existing DL frameworks.
http://dgl.ai
Apache License 2.0
13.18k stars 2.99k forks source link

DGL not work with numpy >= 2.0 #7468

Closed jalencato closed 4 days ago

jalencato commented 2 weeks ago

🐛 Bug

To Reproduce

Steps to reproduce the behavior:

  1. pip3 install dgl==2.2.1+cu121 -f https://data.dgl.ai/wheels/torch-2.2/cu121/repo.html
  2. Run a python script with import dgl

Error:

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.

Expected behavior

Environment

Additional context

pyynb commented 2 weeks ago

NumPy 2.0 is the latest release and may have some incompatibilities with the NumPy 1.x we used previously. We are currently looking into it. Downgrading NumPy to version 1.x can resolve this issue.

jalencato commented 2 weeks ago

Just FYI: The compatible problem does not appear when using DGL on torch 2.3. It always happens for torch version <= 2.2

jakirkham commented 1 week ago

Well PyTorch 2.3.0 is needed to support NumPy 2 : https://github.com/pytorch/pytorch/issues/107302

Earlier PyTorch versions are incompatible with NumPy 2

So it sounds like users just need to upgrade PyTorch and this is not actually a DGL problem

Edit: Rephrase to further clarify

Rhett-Ying commented 1 week ago

@jakirkham Thanks for your info. we'll look into and confirm.

Rhett-Ying commented 4 days ago

As we discussed https://github.com/dmlc/dgl/pull/7479#issuecomment-2199158291, it's user's responsibility to either downgrade numpy or upgrade torch. DGL itself does have such requirement.