Installing with pip

Try to install it with

pip install networkx

and an attempt will be made to find and install an appropriate version that matches your operating system and Python version.

You can also get NetworkX from the Python Package Index manually at To use pip, you need to have setuptools installed.

You can install the development version (at with

pip install git://

More download file options are at

Installing with conda

If you are using Ananconda/Miniconda distribution of Python then you can update/install NetworkX to the latest version with

conda install networkx

or to update an existing installation

conda update networkx

Installing from source

You can install from source by downloading a source archive file (tar.gz or zip) or by checking out the source files from the Git source code repository.

NetworkX is a pure Python package; you don’t need a compiler to build or install it.

Source archive file

  1. Download the source (tar.gz or zip file) from or get the latest development version from
  2. Unpack and change directory to the source directory (it should have the files README.txt and
  3. Run python install to build and install
  4. (Optional) Run nosetests to execute the tests if you have nose installed.


  1. Clone the networkx repository (see for options)

    git clone
  2. Change directory to networkx

  3. Run python install to build and install

  4. (Optional) Run nosetests to execute the tests if you have nose installed.

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

For example

python install --prefix=/home/username/python


python install --home=~


python install --user

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 for further details.



To use NetworkX you need Python 2.7, 3.3 or later.

The easiest way to get Python and most optional packages is to install the Enthought Python distribution “Canopy”.

There are several other distributions that contain the key packages you need for scientific computing. See for a list.

Optional packages

The following are optional packages that NetworkX can use to provide additional functions.


Provides matrix representation of graphs and is used in some graph algorithms for high-performance matrix computations.


Provides sparse matrix representation of graphs and many numerical scientific tools.


Provides flexible drawing of graphs.


In conjunction with either

provides graph drawing and graph layout algorithms.


Required for YAML format reading and writing.

Other packages

These are extra packages you may consider using with NetworkX