Commit 419ffbde authored by Gan Quan's avatar Gan Quan Committed by Minjie Wang
Browse files

[Doc] Installation guide (#223)

* docstrings for graph mutation & queries

* [Doc] contrib.sampler. (#200)

* subgraph docs

* updates

* added installation guide

* style fix

* package name fixes

* adding it back...

* fix as requested

* adding link

* mac os build instructions

* OS -> macOS
parent b0c76d48
Install DGL Install DGL
============ ============
At this stage, we recommend installing DGL from source. To quickly try out DGL and its demo/tutorials, checkout `Install from docker`_. At this stage, we recommend installing DGL from ``conda`` or ``pip``.
Get source codes System requirements
---------------- -------------------
First, download the source files from github. Note you need to use the ``--recursive`` option to Currently DGL is tested on
also clone the submodules.
* Ubuntu 16.04
* macOS X
* Windows 7
DGL is expected to work on all Linux distributions later than Ubuntu 16.04, macOS X, and
Windows 7 or later.
DGL also requires the Python version to be 3.5 or later. Python 3.4 or less is not
tested, and Python 2 support is coming.
DGL supports multiple tensor libraries (e.g. PyTorch, MXNet) as backends; refer
`Working with different backends`_ for requirements on backends and how to select a
backend.
Install from conda
----------------------
One can either grab `miniconda <https://conda.io/miniconda.html>`_ or
the full `anaconda <https://www.anaconda.com/download/>`_ if ``conda``
has not been installed.
Once the conda environment is activated, run
.. code:: bash .. code:: bash
git clone --recursive https://github.com/jermainewang/dgl.git conda install -c dglteam dgl
You can also clone the repository first and type following commands: Install from pip
----------------
One can simply run the following command to install via ``pip``:
.. code:: bash .. code:: bash
git submodule init pip install dgl
git submodule update
Working with different backends
-------------------------------
Currently DGL supports PyTorch and MXNet.
Switching backend
`````````````````
The backend is controlled by ``DGLBACKEND`` environment variable, which defaults to
``pytorch``. Currently it supports the following values:
+---------+---------+--------------------------------------------------+
| Value | Backend | Memo |
+=========+=========+==================================================+
| pytorch | PyTorch | Requires 0.4.1 or later; see |
| | | `official website <https://pytorch.org>`_ |
+---------+---------+--------------------------------------------------+
| mxnet | MXNet | Requires nightly build; run the following |
| | | command to install (TODO): |
| | | |
| | | .. code:: bash |
| | | |
| | | pip install --pre mxnet |
+---------+---------+--------------------------------------------------+
| numpy | NumPy | Does not support gradient computation |
+---------+---------+--------------------------------------------------+
Install from source
-------------------
First, download the source files from GitHub:
.. code:: bash
git clone --recursive https://github.com/jermainewang/dgl.git
Build shared library One can also clone the repository first and run the following:
--------------------
Before building the library, please make sure the following dependencies are installed
(use ubuntu as an example):
.. code:: bash .. code:: bash
sudo apt-get update git submodule init
sudo apt-get install -y python git submodule update
Linux
`````
We use cmake (minimal version 2.8) to build the library. Install the system packages for building the shared library, for Debian/Ubuntu
users, run:
.. code:: bash .. code:: bash
mkdir build sudo apt-get update
cd build sudo apt-get install -y build-essential build-dep python3-dev make cmake
cmake ..
make -j4
Build python binding For Fedora/RHEL/CentOS users, run:
--------------------
DGL's python binding depends on following packages (tested version):
* numpy (>= 1.14.0) .. code:: bash
* scipy (>= 1.1.0)
* networkx (>= 2.1) sudo yum install -y gcc-c++ python3-devel make cmake
To install them, use following command: Build the shared library and install the Python binding afterwards:
.. code:: bash .. code:: bash
pip install --user numpy scipy networkx mkdir build
cd build
cmake ..
make -j4
cd ../python
python setup.py install
macOS
`````
Installation on macOS is similar to Linux. But macOS users need to install
building tools like clang, GNU Make, cmake first.
There are several ways to setup DGL's python binding. We recommend developers at the current stage Tools like clang and GNU Make are packaged in **Command Line Tools** for macOS. To
use environment variables to find python packages. install:
.. code:: bash .. code:: bash
export DGL_HOME=/path/to/dgl xcode-select --install
export PYTHONPATH=${DGL_HOME}/python:${PYTHONPATH}
export DGL_LIBRARY_PATH=${DGL_HOME}/build
The ``DGL_LIBRARY_PATH`` variable is used for our python package to locate the shared library To install other needed packages like cmake, we recommend first installing
built above. Use following command to test whether the installation is successful or not. **Homebrew**, which is a popular package manager for macOS. Detailed
instructions can be found on its `homepage <https://brew.sh/>`_.
After installation of Homebrew, install cmake by:
.. code:: bash .. code:: bash
python -c 'import dgl' brew install cmake
Install from docker Then go to root directory of DGL repository, build shared library and
------------------- install Python binding for DGL:
TBD
.. code:: bash
Install on Windows/MinGW mkdir build
------------------------ cd build
Make sure you have the following installed: cmake ..
make -j4
cd ../python
python setup.py install
* CMake We tested installation on macOS X with clang 10.0.0, GNU Make 3.81, and cmake
* MinGW/GCC (G++) 3.13.1.
* MinGW/Make
You can grab them from Anaconda. Windows
```````
In the command line prompt, run: Currently Windows source build is tested with CMake and MinGW/GCC. We highly recommend
using CMake and GCC from `conda installations <https://conda.io/miniconda.html>`_. To
do so, run
.. code:: bash .. code:: bash
md build conda install cmake m2w64-gcc m2w64-make
cd build
cmake -DCMAKE_CXX_FLAGS="-DDMLC_LOG_STACK_TRACE=0 -DTVM_EXPORTS" -DCMAKE_MAKE_PROGRAM=mingw32-make .. -G "MSYS Makefiles" Then build the shared library and install the Python binding:
mingw32-make
set DGL_LIBRARY_PATH=%CD% .. code::
md build
cd build
cmake -DCMAKE_CXX_FLAGS="-DDMLC_LOG_STACK_TRACE=0 -DTVM_EXPORTS" -DCMAKE_MAKE_PROGRAM=mingw32-make .. -G "MSYS Makefiles"
mingw32-make
cd ..\python
python setup.py install
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment