"vscode:/vscode.git/clone" did not exist on "21f023ec1acefbe3efa470451838dab4c133e098"
index.rst 2.09 KB
Newer Older
Minjie Wang's avatar
Minjie Wang committed
1
2
3
Install DGL
============

Minjie Wang's avatar
Minjie Wang committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
At this stage, we recommend installing DGL from source. To quickly try out DGL and its demo/tutorials, checkout `Install from docker`_.

Get source codes
----------------
First, download the source files from github. Note you need to use the ``--recursive`` option to
also clone the submodules.

.. code:: bash

    git clone --recursive https://github.com/jermainewang/dgl.git

You can also clone the repository first and type following commands:

.. code:: bash

    git submodule init
    git submodule update


Build shared library
--------------------
Before building the library, please make sure the following dependencies are installed
(use ubuntu as an example):

.. code:: bash

    sudo apt-get update
    sudo apt-get install -y python

We use cmake (minimal version 2.8) to build the library.

.. code:: bash

    mkdir build
    cd build
    cmake ..
    make -j4

Build python binding
--------------------
DGL's python binding depends on following packages (tested version):

* numpy (>= 1.14.0)
* scipy (>= 1.1.0)
* networkx (>= 2.1)

To install them, use following command:

.. code:: bash

    pip install --user numpy scipy networkx

There are several ways to setup DGL's python binding. We recommend developers at the current stage
use environment variables to find python packages.

.. code:: bash

    export DGL_HOME=/path/to/dgl
yzh119's avatar
yzh119 committed
62
63
    export PYTHONPATH=${DGL_HOME}/python:${PYTHONPATH}
    export DGL_LIBRARY_PATH=${DGL_HOME}/build
Minjie Wang's avatar
Minjie Wang committed
64
65
66
67
68
69
70
71
72
73
74

The ``DGL_LIBRARY_PATH`` variable is used for our python package to locate the shared library
built above. Use following command to test whether the installation is successful or not.

.. code:: bash

    python -c 'import dgl'

Install from docker
-------------------
TBD
Minjie Wang's avatar
Minjie Wang committed
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

Install on Windows/MinGW
------------------------
Make sure you have the following installed:

* CMake
* MinGW/GCC (G++)
* MinGW/Make

You can grab them from Anaconda.

In the command line prompt, run:

.. code:: bash

    md build
    cd build
    cmake -DCMAKE_CXX_FLAGS="-DDMLC_LOG_STACK_TRACE=0 -DTVM_EXPORTS" .. -G "MinGW Makefiles"
    mingw32-make
    set DGL_LIBRARY_PATH=%CD%