pmneila/PyMaxflow

ImportError: No module named networkx

mrgloom opened this issue · 4 comments

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

Problem solved with: sudo pip install networkx

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.

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

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

image