Installation¶
Quick Install¶
DeepGraph can be installed via pip from PyPI
$ pip install deepgraph
Depending on your system, you may need root privileges. On UNIX-based operating systems (Linux, Mac OS X etc.) this is achieved with sudo
$ sudo pip install deepgraph
Alternatively, if you’re using Conda, install with
$ conda install -c conda-forge deepgraph
Installing from Source¶
Alternatively, you can install DeepGraph from source by downloading a source archive file (tar.gz or zip).
Source Archive File¶
- Download the source (tar.gz or zip file) from https://pypi.python.org/pypi/deepgraph/ or https://github.com/deepgraph/deepgraph/
- Unpack and change directory to the source directory (it should have the files README.rst and setup.py).
- Run
python setup.py install
to build and install. As a developer, you may want to install using cython:python setup.py install --use-cython
.- (Optional) Run
py.test
to execute the tests if you have pytest installed.
GitHub¶
Clone the deepgraph repostitory
Change directory to
deepgraph
Run
python setup.py install
to build and install. As a developer, you may want to install using cython:python setup.py install --use-cython
.(Optional) Run
py.test
to execute the tests if you have pytest installed.
Installing without Root Privileges¶
If you don’t have permission to install software on your system, you can
install into another directory using the --user
, --prefix
,
or --home
flags to setup.py.
For example
$ python setup.py install --prefix=/home/username/python
or
$ python setup.py install --home=~
or
$ python setup.py install --user
Note: If you didn’t install in the standard Python site-packages directory you will need to set your PYTHONPATH variable to the alternate location. See here for further details.
Requirements¶
The easiest way to get Python and the required/optional packages is to use Conda (or Miniconda), a cross-platform (Linux, Mac OS X, Windows) Python distribution for data analytics and scientific computing.
Pandas¶
Pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.
Pandas is the core dependency of DeepGraph, and it is highly recommended to install the recommended and optional dependencies of Pandas as well.
Recommended Packages¶
The following are recommended packages that DeepGraph can use to provide additional functionality.
Matplotlib¶
Matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms.
Allows you to use the plotting methods of DeepGraph.
Matplotlib Basemap Toolkit¶
basemap is an add-on toolkit for matplotlib that lets you plot data on map projections with coastlines, lakes, rivers and political boundaries. See the basemap tutorial for documentation and examples of what it can do.
Used by plot_map
and
plot_map_generator
to plot networks on map
projections.
PyTables¶
PyTables is a package for managing hierarchical datasets and designed to efficiently and easily cope with extremely large amounts of data.
Necessary for HDF5-based storage of pandas DataFrames. DeepGraph’s
core class
may be initialized with a HDFStore
containing a node table in order to iteratively create edges directly from disc
(see create_edges
and
create_edges_ft
).
SciPy¶
SciPy is a Python-based ecosystem of open-source software for mathematics, science, and engineering.
Allows you to convert from DeepGraph’s network representation to sparse adjacency
matrices (see return_cs_graph
).
NetworkX¶
NetworkX is a Python language software package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.
Allows you to convert from DeepGraph’s network representation to NetworkX’s network
representation (see return_nx_graph
).
Graph-Tool¶
graph_tool is an efficient Python module for manipulation and statistical analysis of graphs (a.k.a. networks).
Allows you to convert from DeepGraph’s network representation to Graph-Tool’s
network representation (see return_gt_graph
).
Conda users can install graph_tool by adding the following channels to their ~/.condarc
$ conda config --add channels conda-forge
$ conda config --add channels ostrokach-forge
Then, install graph-tool
$ conda install graph-tool
You can test your graph-tool installation by
$ python -c "from graph_tool.all import *"
Optional Packages¶
The following packages are considered to provide very useful tools and methods.
Scikit-Learn¶
sklearn is a Python module integrating classical machine learning algorithms in the tightly-knit world of scientific Python packages (numpy, scipy, matplotlib).
Sklearn-pandas¶
sklearn-pandas provides a bridge between Scikit-Learn’s machine learning methods and pandas-style Data Frames.