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

Cannot find DGL C++ graphbolt library for torch 2.4.1 #7822

Open
DanielYang59 opened this issue Oct 13, 2024 · 8 comments
Open

Cannot find DGL C++ graphbolt library for torch 2.4.1 #7822

DanielYang59 opened this issue Oct 13, 2024 · 8 comments

Comments

@DanielYang59
Copy link

DanielYang59 commented Oct 13, 2024

🐛 Bug

I believe this is a duplicate of #7247 (but for torch 2.4.1).

To Reproduce

Steps to reproduce the behavior:

>>> import dgl

Traceback (most recent call last):
  File "/Users/yang/developer/test/test_mult.py", line 1, in <module>
    import dgl
  File "/Users/yang/developer/test/venv/lib/python3.12/site-packages/dgl/__init__.py", line 16, in <module>
    from . import (
  File "/Users/yang/developer/test/venv/lib/python3.12/site-packages/dgl/dataloading/__init__.py", line 13, in <module>
    from .dataloader import *
  File "/Users/yang/developer/test/venv/lib/python3.12/site-packages/dgl/dataloading/dataloader.py", line 27, in <module>
    from ..distributed import DistGraph
  File "/Users/yang/developer/test/venv/lib/python3.12/site-packages/dgl/distributed/__init__.py", line 5, in <module>
    from .dist_graph import DistGraph, DistGraphServer, edge_split, node_split
  File "/Users/yang/developer/test/venv/lib/python3.12/site-packages/dgl/distributed/dist_graph.py", line 11, in <module>
    from .. import backend as F, graphbolt as gb, heterograph_index
  File "/Users/yang/developer/test/venv/lib/python3.12/site-packages/dgl/graphbolt/__init__.py", line 36, in <module>
    load_graphbolt()
  File "/Users/yang/developer/test/venv/lib/python3.12/site-packages/dgl/graphbolt/__init__.py", line 26, in load_graphbolt
    raise FileNotFoundError(
FileNotFoundError: Cannot find DGL C++ graphbolt library at /Users/yang/developer/test/venv/lib/python3.12/site-packages/dgl/graphbolt/libgraphbolt_pytorch_2.4.1.dylib

Environment

  • DGL Version (e.g., 1.0): 2.2.0
  • Backend Library & Version (e.g., PyTorch 0.4.1, MXNet/Gluon 1.3): pytorch 2.4.1
  • OS (e.g., Linux): MacOS 15.0.1
  • How you installed DGL (conda, pip, source): pip
  • Python version: 3.12.7

Additional context

>>> cd /Users/yang/developer/test/venv/lib/python3.12/site-packages/dgl/graphbolt
>>> ls libgraphbolt_pytorch_2.*

libgraphbolt_pytorch_2.1.0.dylib libgraphbolt_pytorch_2.2.0.dylib libgraphbolt_pytorch_2.3.0.dylib
libgraphbolt_pytorch_2.1.1.dylib libgraphbolt_pytorch_2.2.1.dylib
libgraphbolt_pytorch_2.1.2.dylib libgraphbolt_pytorch_2.2.2.dylib
@Alkomnenos
Copy link

Same error, have tried all combination of versions. Would appreciate a head up if someone managed to solve this :)

@colintle
Copy link

Anyone got this working yet?

@ph-mehdi
Copy link

We still have this problem in new versions, has anyone fixed this problem?

@beviu
Copy link

beviu commented Nov 2, 2024

As a workaround, I was able to make import dgl successfully by installing older versions of PyTorch and torchdata:

$ pip install torch==2.2.1
$ pip install torchdata==0.7.1

@523718
Copy link

523718 commented Nov 4, 2024

In dgl website,it says:

Since 2024.06.27, we have stopped providing packages for Windows and MacOS. The latest version of available package is 2.2.1. For newer versions, please install from source.

If you have installed dgl-cudaXX.X package, please uninstall it first.

may be this can give you some ideas.

And i also met this problem,but i need to install 2.2.1version of dgl in windows 10.it seems like i should install it from source code?If anybody knows that ,please tell me how i could solve this ,thank you so much.

@Alkomnenos
Copy link

I have managed to make mine working, under the DGL package site there are several "libgraphbolt_pytorch_2.x.x.dylib" files you could find and you will know which versions of pytorch you should use. Mine issue arose from having a corrupted pytorch version registered and DGL could not properly recognize the pytorch 2.2.1 that I have installed, manually removing the corrupted pytorch files from site-packages has fixed the problem for me

@DanielYang59
Copy link
Author

DanielYang59 commented Nov 4, 2024

Since 2024.06.27, we have stopped providing packages for Windows and MacOS. The latest version of available package is 2.2.1. For newer versions, please install from source.

Thanks for sharing the info.


Also I appreciate everyone's comment, however downgrading to torch==2.2.1 is not the solution.

It turns out dgl does ship pre-built binary here, but only for certain versions of torch and python, for other versions we might need to build from source.

@DanielYang59
Copy link
Author

DanielYang59 commented Nov 4, 2024

I could confirm building from source following the guidance works for my Ubuntu 22.04 machine.

For a CPU-only build with torch==2.4.1, python==3.12:

git clone --recurse-submodules https://github.com/dmlc/dgl.git  && cd dgl

bash script/create_dev_conda_env.sh -c -t 2.4.1 -p 3.12  # or other versions of your choice
bash script/build_dgl.sh -c

cd python && pip install .
$ pip freeze | grep torch
torch==2.4.1+cpu
torch-geometric==2.6.1
torcheval==0.0.7
torchmetrics==1.5.1

$ pip freeze | grep dgl
dgl @ file:///home/yang/dgl/python

$ python -c "import dgl"  # no error this time

Worth noting is it takes quite some time to download & install the conda env (> 10 min) and a lot of RAM to build (~ 30 GB), make sure you have enough RAM otherwise you might see OOM errors.

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

No branches or pull requests

6 participants