pmneila / PyMaxflow

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

regarding the ImportError: cannot import name '_maxflow' from 'maxflow' #45

Closed wenouyang closed 1 year ago

wenouyang commented 4 years ago

Hello, I have successfully installed the package using pip. However, when I try to test the program, I got the following error message. I think it might be related to the _maxflow.pyx but I do not know the reason.

Traceback (most recent call last):
  File "test_maxflow.py", line 6, in <module>
    import maxflow
  File "C:\Users\Desktop\Experiments\PyMaxflow-master\maxflow\__init__.py", line 36, in <module>
    from . import _maxflow
ImportError: cannot import name '_maxflow' from 'maxflow' (C:\Users\Desktop\Experiments\PyMaxflow-master\maxflow\__init__.py)
nirmalsnair commented 2 years ago

I think the source files are causing this error. Since you've already installed PyMaxflow via pip, you don't have to keep the source files. Just move the test_maxflow.py script and the examples folder to a separate location and run.

pmneila commented 1 year ago

Installing from pip now will install a pre-compiled binary wheel for most platforms and Python versions. This problem should not happen anymore.

Best