How to upgrade networkx to developer version in Linux

Weight functions are only available on networkx development version.
To install it you need to do the following:

git clone https://github.com/networkx/networkx.git
cd networkx
sudo python setup.py install
nosetest

ERROR: Failure: ImportError (No module named coverage)
ImportError: No module named pandas

To fix it, install these libraries and re-run nesetest:

sudo pip install pandas coverage
nosetests
----------------------------------------------------------------------
Ran 3045 tests in 33.191s


OK (SKIP=7)

If you run your python console you can ask for networkx version as follows:

python                
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import networkx
>>> print networkx.__version__

2.0.dev_20170321173742

But, if you run your code it still be using version 1.1
Now you need to remove the previous version and re-install the last version:

sudo pip uninstall networkx
sudo python setup.py install

Enjoy it!

Comments

Popular posts from this blog

from: can't read /var/mail/ in Python scripts

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04

How to install a WhatsApp bot based on Python