pmneila/PyMaxflow

Problem importing `maxflow.fastmin`

CrisDamian opened this issue · 1 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!