loli / medpy

Medical image processing in Python
http://loli.github.io/medpy/
GNU General Public License v3.0
558 stars 136 forks source link

test failed for graphcut.maxflow #89

Closed hubutui closed 3 months ago

hubutui commented 5 years ago

Hi, I'm trying to package medpy for ArchLinux. After building medpy, I run PYTHONPATH="${PWD}/build/lib.linux-x86_64-3.7" nosetests -v, and here is the log.

==> Starting check()...
Failure: ModuleNotFoundError (No module named 'medpy.graphcut.maxflow') ... ERROR
Failure: ModuleNotFoundError (No module named 'medpy.graphcut.maxflow') ... ERROR

======================================================================
ERROR: Failure: ModuleNotFoundError (No module named 'medpy.graphcut.maxflow')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/usr/lib/python3.7/site-packages/nose/loader.py", line 417, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python3.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python3.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/lib/python3.7/imp.py", line 244, in load_module
    return load_package(name, filename)
  File "/usr/lib/python3.7/imp.py", line 216, in load_package
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/build/python-medpy/src/medpy-0.4.0/medpy/graphcut/__init__.py", line 200, in <module>
    from .maxflow import GraphDouble, GraphFloat, GraphInt # this always triggers an error in Eclipse, but is right
ModuleNotFoundError: No module named 'medpy.graphcut.maxflow'

======================================================================
ERROR: Failure: ModuleNotFoundError (No module named 'medpy.graphcut.maxflow')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/usr/lib/python3.7/site-packages/nose/loader.py", line 417, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python3.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python3.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/lib/python3.7/imp.py", line 244, in load_module
    return load_package(name, filename)
  File "/usr/lib/python3.7/imp.py", line 216, in load_package
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/build/python-medpy/src/medpy-0.4.0/tests/graphcut_/__init__.py", line 2, in <module>
    from .graph import TestGraph
  File "/build/python-medpy/src/medpy-0.4.0/tests/graphcut_/graph.py", line 19, in <module>
    from medpy.graphcut import GCGraph
  File "/build/python-medpy/src/medpy-0.4.0/medpy/graphcut/__init__.py", line 200, in <module>
    from .maxflow import GraphDouble, GraphFloat, GraphInt # this always triggers an error in Eclipse, but is right
ModuleNotFoundError: No module named 'medpy.graphcut.maxflow'

----------------------------------------------------------------------
Ran 2 tests in 0.382s

FAILED (errors=2)

Actually, if I skip the check, I could still import medpy.graphcut.maxflow without error. I'm not sure why the test failed.

loli commented 5 years ago

Thanks for pointing this out! It might have something to do with the relative import and conflicting names... I will look into this for the next release.

EricKani commented 4 years ago

Hello @loli ~

Has this issue been solved~ I encounter this error also, even after I install Boost.python and reinstall this package...

Thanks, Best, eric

loli commented 4 years ago

The graphcut plugin is notoriously tricky. If you don't need it, you can safely ignore this.

On Tue, 24 Mar 2020, 20:42 EricKani, notifications@github.com wrote:

Hello @loli https://github.com/loli ~

Has this issue been solved~ I encounter this error also, even after I install Boost.python and reinstall this package...

Thanks, Best, eric

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/loli/medpy/issues/89#issuecomment-603466868, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGLK7WS4B74K3UNUYMXZDLRJEELZANCNFSM4HJ4NN7Q .

EricKani commented 4 years ago

Hi~

Sorry I am not very good on English… Do you mean the integration of graphcut plugin is a hard problem for most people?But I really need this plugin…Do you have any other solutions or suggestions… Thank you very much!

Best, eric

On 03/28/2020 00:56, Oskar M. wrote:

The graphcut plugin is notoriously tricky. If you don't need it, you can safely ignore this.

On Tue, 24 Mar 2020, 20:42 EricKani, notifications@github.com wrote:

Hello @loli https://github.com/loli ~

Has this issue been solved~ I encounter this error also, even after I install Boost.python and reinstall this package...

Thanks, Best, eric

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/loli/medpy/issues/89#issuecomment-603466868, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGLK7WS4B74K3UNUYMXZDLRJEELZANCNFSM4HJ4NN7Q .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

YunxinZhong commented 4 years ago

The follow link solve this issue. Install Boost.python and modify setup.py.

https://pengyizhang.github.io/2020/04/05/medpyinstall/

EricKani commented 4 years ago

The follow link solve this issue. Install Boost.python and modify setup.py.

https://pengyizhang.github.io/2020/04/05/medpyinstall/

Thanks for your reply~ But my server is Linux system. A little bit not suitable for my scene.

jjerphan commented 4 years ago

Hello,

I also get the same problem on Fedora 32 using:

be it by installing it from source or via pypi. libboost-python is installed on my machine aswell.

87 and #81 are related an relevant issues.

loli commented 3 months ago

Should now work for most ditros: see also http://loli.github.io/medpy/installation/graphcutsupport.html

And, in case it doesn't, can be installed pre-packed from conda-forge.