Device API gpu is not enabled

I am having issues making DGL work with CUDA, this is my current setup:

CUDA Version: 10.2

Cuda works correctly (I use it with both Keras and Torch):

>>> torch.cuda.is_available()
>>> torch.device('cuda:0')
device(type='cuda', index=0)
>>> torch.zeros(1).cuda()
tensor([0.], device='cuda:0')

But of course when I run:

I get:

DGLError: [17:03:22] /opt/dgl/src/runtime/ Check failed: allow_missing: Device API gpu is not enabled. Please install the cuda version of dgl.

So I tried to install and compile DGL from sources (enabling CUDA with CMAKE) but the result doesn’t change. What am I missing?

Thank you!

Can you first try uninstalling DGL and then reinstalling GPU enabled DGL? It’s possible that you have multiple versions of DGL installed and the one you import is actually a version without GPU support. You can verify the success of uninstalling DGL by failing to import dgl.

1 Like

A big thanks @mufeili (as usual ;)) I solved it with your advice. Despite uninstalling the manually compiled copy and the one installed via pip one version of the package was still there.

For any future person coming here with the same problem (uninstalling DLG and still finding the package to be available) just print its path:

python3 -c 'import dgl; print(dgl.__path__)'

and remove it.


Awesome! Glad it helps :slight_smile:

For me this worked.

python -m pip uninstall dgl

The problem is not fully solved. There is another scenario where the GPU could be not compatible with DGL (example using GPU V100 on colab). I didn’t solve this issue.