0

On eclipse, using the PyDev plugin (python),I am trying to use the networkx library. It was not there by default so I downloaded the file networkx-1.10-py3.4.egg (md5) from this source: https://pypi.python.org/pypi/networkx/

I added the library to my project using the steps provided in the answer to this question: How to add python "libraries" to Eclypse and pydev

Howver, when I run my program, I get the following error:

Traceback (most recent call last):
  File "C:\Users\zjalmahmoud\workspace\Baysian_Network\bayes_net_inference.py", line 1, in <module>
    import networkx as nx
  File "C:\Users\zjalmahmoud\workspace\Baysian_Network\networkx-1.10-py3.4.egg\networkx\__init__.py", line 68, in <module>
  File "C:\Users\zjalmahmoud\workspace\Baysian_Network\networkx-1.10-py3.4.egg\networkx\utils\__init__.py", line 2, in <module>
  File "C:\Users\zjalmahmoud\workspace\Baysian_Network\networkx-1.10-py3.4.egg\networkx\utils\decorators.py", line 7, in <module>
ImportError: No module named 'decorator'

How can I solve my problem? Thanks.

Community
  • 1
  • 1
Traveling Salesman
  • 2,209
  • 11
  • 46
  • 83

1 Answers1

1

You have installed NetworkX into your project. This is not a good idea. You want to have separation of libraries.

This is a way of solving it. Anaconda is packaged Python with 195 libraries (including NetworkX and prerequisites). Download is here. Installing that is easy and setup is easier than the one you have. Getting new modules means opening up a terminal and typing either of these 2 commands.

conda install moduleName
pip install moduleName

Since you already have PyDev installed you can go to eclipse-> preferences-> PyDev-> Interpreters-> Python Interpreter and click "New" and point it to the place where you have installed Anaconda. Give it a name "anaconda-3.5" for example. Then hit 'apply' and 'OK'.

When you install new modules with pip or conda eclipse will automatically recognize that it needs to include those new modules. (a popup will result)

Back2Basics
  • 7,406
  • 2
  • 32
  • 45