Uninstall and install dgl

Hi,
I want to uninstall DGL completely and I used pip uninstall dgl but the problem is that I can import dgl in the python after that.
I can’t remember how I install it. it would be very nice if you help me to solve this problem

Thanks

Try the following in a python repl:

>>> import dgl
>>> dgl.__path__

Take a look at the path and uninstall it correspondingly. For example, it might be your pip local path or conda path or path set by PYTHON_PATH variable.

Thanks a lot for your help it’s working.
But just to check so I should go to this path and delete dgl folder or go to this directory and then run pip uninstall dgl and then install it again.

is it true for installing the latest version of DGL?

Since I face a downloading problem data and one of the author told me try to install the latest version of the DGL I did what I mentioned and I still get the same error. I’m wondering if the procedure is all I should do or I skip a step?

It’s better to first figure out which package manager makes it visible and use that package manager to uninstall it. I would not delete the folder directly.

To install the latest DGL:

Using anaconda

conda install -c dglteam dgl           # cpu version
conda install -c dglteam dgl-cuda9.0   # CUDA 9.0
conda install -c dglteam dgl-cuda9.2   # CUDA 9.2
conda install -c dglteam dgl-cuda10.0  # CUDA 10.0

Using pip

pip install dgl       # cpu version
pip install dgl-cu90  # CUDA 9.0
pip install dgl-cu92  # CUDA 9.2
pip install dgl-cu100 # CUDA 10.0

Specify --upgrade option in the end to override existing version. Note that if you’ve installed, for example, dgl-cu90, you need to use the same package name when uninstalling it. To check the installed version, use:

python -c 'import dgl; print(dgl.__version__)'

Thanks for your reply. but I have a question what do you mean by package manager?
I know how to install it but I’m not sure for the uninstalling procedure. In my previous message, I wrote installing instead of uninstalling. Sorry about that.
So I repeat my question: But just to check so I should go to this path and delete dgl folder or go to this directory and then run pip uninstall dgl and then install it again.

is it true for uninstalling the latest version of DGL?
and then for installing I will use related commands

I think this is the simplest problem in DGL that absolutely cannot be left in shadow that has no clear solution.

I also encounter this problem a while ago, i reccommend you to uninstall it in a proper manner (no manual deletion). (put in mind that i almost know nothing about programming, let alone python)
This part is truly unnerving at first.
Right now i use windows 10, i install DGL in specific conda environment, in non-administrator area. and it work great for almost all tutorial. I can’t say for other specification, but here is what i do.

What isn’t written in tutorial is that (at least in my case) if you use windows, there are 2 part of installation. it is better if the writing tutorial part in this part is restructured.

The bottom line is that you need both Visual Studio 2017 and Anaconda to do this part.
Visual Studio is for cmake installation, and Anaconda is for dgl installation.

  1. The first thing is like i say you uninstall the same way you install it.
  2. Create folder for CMake installation installation, e.g : DGLVS2017.
  3. Install Visual Studio 2017 anywhere (not necesarily in (2)) : download the installer, community version is enough. ensure all package that include C++ or Cmake are download, and installed.
  4. Clone the source code git clone https://github.com/dmlc/dgl using GitHub App. in (2), create subfolder name ‘build’ there.
  5. Open Native 2017 prompt, cd to those ‘build’ directory. and run the following line separatedly.

cmake -DCMAKE_CXX_FLAGS="-DDMLC_LOG_STACK_TRACE=0 -DDGL_EXPORTS" -DCMAKE_MAKE_PROGRAM=mingw32-make … -G “MSYS Makefiles”

mingw32-make

cd …\python

python setup.py install

  1. Install Anaconda in any recent version: download and install it by default.
  2. Make a special folder for conda environment preparation.
  3. Open Anaconda Powershell Prompt
  4. cd into (6)
  5. Create conda environment, use python = 3.6
  6. Install dgl by typing : conda install -c dglteam dgl=0.5.2
  7. Install jupyter notebook from anaconda navigator.
  8. Try to run some tutorial in basics “https://docs.dgl.ai/guide/graph-graphs-nodes-edges.html
  9. If something not running right (i face it the first time because pytorch version isn’t compatible"), try make adjustment by installing anything necessary in conda (reccomendedly, not conda-forge). Redo (12) again, find what is lack until the code run smoothly.
  10. Finish.

I think that is enough, i try to recall and confirm by my own documentation of installation as close as possible. I think this is very understated step in tutorial. Have a nice try, i wish you success if you haven’t solved it yet (I know this post is from a year ago).

2 Likes

What i mean ‘no clear solution’ is that there is no/(not edited yet) official written procedure.

Thanks for your information in installing dgl for Windows from source!

Currently MinGW is no longer supported, and we recommend you to use MSBuild to compile on Windows. The commands are (as in the installation instructions)

MD build
CD build
cmake -DCMAKE_CXX_FLAGS="/DDGL_EXPORTS" -DCMAKE_CONFIGURATION_TYPES="Release" .. -G "Visual Studio 15 2017 Win64"
msbuild dgl.sln
cd ..\python
python setup.py install

Just an addition: to uninstall it completely, you may need to run either conda uninstall dgl-cudaXX.X or pip uninstall dgl-cuXXX. If you have a conda environment, you can check how you installed dgl via

conda list dgl
1 Like