ModuleNotFoundError: No module named 'dgl.graph'

OS - Windows 10
Pytorch - 1.7.1
Tensorflow - 2.3.0
DGl - 0.5.3
CUDA - 11.0
If i try to load dgl graphs using my code i get this error.

File "model_bind5.py", line 85, in <module>
    model = pickle.load(fp)
ModuleNotFoundError: No module named 'dgl.graph'

This started after i installed the CUDA 11 version of dgl. How to fix this?

Can you try uninstalling DGL first? Note that there’s a chance that you have installed multiple versions of DGL and you need to uninstall multiple times until you cannot import dgl. Also, why did you install both PyTorch and TensorFlow?

Sounds like the pickle is created from an old version (0.4.3-). Is it possible to remake the pickle file with the newer version?

Yes this was the case. No it is not possible so im just downgrading my installation.

@BarclayII how do i install the cuda version of dgl 0.4.3?

Try

pip install dgl-cuXX==0.4.3

if you installed dgl from pip, or

conda install dgl-cudaX.X=0.4.3 -c dglteam

if from conda.

1 Like

@BarclayII it is not available on conda nor on pip

Sorry, try replacing 0.4.3 with 0.4.3post2

conda install dgl-cuda11.0=0.4.3post2 -c dglteam this still shows not available.

0.4.3post2 does not support CUDA 11.0. You’ll have to try older CUDA versions.

  • Have you solved it? I have the same problem.
2 Likes

I am also having the same problem.

1 Like

Hi, I will close this post because it is pretty old. If you still have this ModuleNotFoundError, please create an issue on github with reproducible steps. Thanks!