pmneila / PyMaxflow

Python library for creating flow networks and computing the maxflow/mincut (aka graph-cuts for Python)
http://pmneila.github.io/PyMaxflow/
246 stars 59 forks source link

ImportError: No module named networkx #28

Closed mrgloom closed 7 years ago

mrgloom commented 7 years ago

After sudo pip install pymaxflow on Ubuntu 14.04

Using this example: https://github.com/pmneila/PyMaxflow/blob/master/examples/binary_restoration.py

I get error:

python binary_restoration.py
Traceback (most recent call last):
  File "binary_restoration.py", line 19, in <module>
    graph = g.get_nx_graph()
  File "maxflow/src/_maxflow.pyx", line 448, in _maxflow.GraphInt.get_nx_graph (maxflow/src/_maxflow.cpp:3390)
ImportError: No module named networkx
mrgloom commented 7 years ago

Problem solved with: sudo pip install networkx

pmneila commented 7 years ago

Hi,

Yes, networkx is an optional package for PyMaxflow since it is only used in the function get_nx_graph, which is there for debugging purposes. That's why it is not included in the dependencies and not installed when you install PyMaxflow.

However, you can install it manually as you did if you need to call get_nx_graph.

Regards.

alma-frankenstein commented 5 years ago

Also, anyone using python3 might try installing it with pip3.

tanghui0102 commented 5 years ago

I successfully done this inWindows 10 with carla 0.9.5. Refer to the figure below. image

image