Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How to install and how to compile networkx python on QGIS?

I always get an error that no module named networkx in the console of QGIS I copied the file networkx in C:\Program Files\Quantum GIS Lisboa\apps\Python27\Lib\site-packages and there are not change.

share|improve this question
1  
Welcome to gis.stackexchange. Could you explain how you are trying to install it? Did you follow the documentation e.g. networkx.github.com/documentation/latest/… ? –  steko Feb 23 '13 at 20:22
    
i am trying to install networkx Python library in QGIS after i installed it,in order to Analyze spatial graphs in QGIS with Python –  user15484 Feb 23 '13 at 20:58

1 Answer 1

I copied the file networkx

It is not a simple file, it is a folder with many files. You must place the entire unzipped networkx folder in C:\Program Files\Quantum GIS Lisboa\apps\Python27\Lib\site-packages (because it is a simple module)

In general, to use a Python module, you must first install it:

python setup.py install

As on Windows, QGIS uses its own version of Python (not in the Windows's registry), without a Python shell, you can:

  1. use the bootstrapped installer for setuptools of Nathan's QGIS Blog, which will install directly the module into a folder rather than looking in the registry
  2. download the networkx version of Christoph Gohlke at Unofficial Windows Binaries for Python Extension Packages, unzip it (it is a .exe file but you can directly unzip it) and place the resulting folder in C:\Program Files\Quantum GIS Lisboa\apps\Python27\Lib\site-packages.

After that, in the Python console of QGIS:

import networkx
networkx.__file__
'C:\Program Files\Quantum GIS Lisboa\apps\Python27\Lib\site-packages\networkx\__init__.pyc'

or

'C:\Program Files\Quantum GIS Lisboa\apps\Python27\Lib\site-packages\networkx-1.7-py2.7.egg\networkx\__init__.pyc'

depending on how you installed the module

share|improve this answer
    
thank you bro for your help,but i did installed python on QGIS and i did place networkx on "C:\Program Files\Quantum GIS Lisboa\apps\Python27\Lib\site-packages" but nothing happend the same mistake,always after i opened QGIS and open console python and i call networkx "import networkx " it's says that no module named networkx, –  user15484 Feb 24 '13 at 10:44
    
never mind,i fond the problem,its in networkx i palced it but hte hole file it must palce the Content of the file networkx in the site packages,htank you again my friend –  user15484 Feb 24 '13 at 10:59
    
@gene I tried the second solution and it worked. Thanks A LOT! –  Pep Apr 27 at 13:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.