FileNotFoundError: Cannot find DGL C++ sparse library 04/26

Hi, I was just trying the new sparse matrix feature and had this error FileNotFoundError: Cannot find DGL C++ sparse library at /home/usr_name/.local/lib/python3.8/site-packages/dgl/dgl_sparse/
I saw an earlier question with the same issue and solved by updating PyTorch:

I tried the same way but didn’t work. I had dgl before and already uninstalled earlier versions.

  • DGL Version: 1.0.1, dglg0 0.0.2
  • Backend Library & Version: pytorch 2.0.0+cu117
  • OS: ubuntu 20.04.4
  • How you installed DGL (conda, pip, source): pip
  • Python version: 3.8.10
  • CUDA/cuDNN version: Cuda compilation tools, release 11.7

Hi @ShaohuiLiu ,

DGL 1.0.1 does not support Pytorch 2.0. Could you try the latest (v1.0.2)?

Thanks for the reply. I ended up in another weird issue, somehow I can only install 1.0.1

pip install  dgl -f

Could you try again? Here is what I got:

gq@REM-5CG2143D2R:~$ pip install  dgl -f
Defaulting to user installation because normal site-packages is not writeable
Looking in links:
DEPRECATION: The HTML index page being used ( is not a proper HTML 5 document. This is in violation of PEP 503 which requires these pages to be well-formed HTML 5 documents. Please reach out to the owners of this index page, and ask them to update this index page to a valid HTML 5 document. pip 22.2 will enforce this behaviour change. Discussion can be found at
Collecting dgl
  Downloading (266.5 MB)
1 Like

It works now! Thank you so much for helping out!

Successfully installed dgl-1.0.2+cu117