pmneila / PyMaxflow

Python library for creating flow networks and computing the maxflow/mincut (aka graph-cuts for Python)

Home Page:http://pmneila.github.io/PyMaxflow/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem importing `maxflow.fastmin`

CrisDamian opened this issue · comments

I installed PyMaxflow version 1.2.8 using pip then
tried using the aexpansion function and got the following error:

Traceback (most recent call last):

  File "<ipython-input-3-9102ce1d5495>", line 1, in <module>
    runfile('C:/Users/DamianCristian/Documents/aexpansione_example.py', wdir='C:/Users/DamianCristian/Documents')

  File "C:\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
    execfile(filename, namespace)

  File "C:\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/DamianCristian/Documents/aexpansione_example.py", line 14, in <module>
    from maxflow.fastmin import aexpansion_grid

  File "C:\Anaconda3\lib\site-packages\maxflow\fastmin.py", line 22, in <module>
    from _maxflow import aexpansion_grid_step, abswap_grid_step

ImportError: No module named '_maxflow'

I solved this by changing line 22 from "C:\Anaconda3\lib\site-packages\maxflow\fastmin.py" to:

     from . _maxflow import aexpansion_grid_step, abswap_grid_step

I thought I should report this.

You are absolutely right. For some reason it was working for me. Just fixed it.

Thank you!