deephealthproject / pyecvl

Python wrapper for the ECVL.
MIT License
4 stars 2 forks source link

No module named 'pyecvl._core' #9

Closed PerloDaniele closed 4 years ago

PerloDaniele commented 4 years ago

Hi,

I'm trying to install pyecvl and I have properly installed ecvl with all components. pyecvl setup.py runs without any problem, but fails at import time.

[perlo@escher pyecvl]$ sudo python3 setup.py install running install running build running build_py creating build/lib.linux-x86_64-3.6 creating build/lib.linux-x86_64-3.6/pyecvl copying pyecvl/__init__.py -> build/lib.linux-x86_64-3.6/pyecvl running build_ext building 'pyecvl._core' extension creating build/temp.linux-x86_64-3.6 creating build/temp.linux-x86_64-3.6/src gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Isrc -I/usr/include/python3.6m -I/root/.local/include/python3.6m -I/usr/include/python3.6m -c src/_core.cpp -o build/temp.linux-x86_64-3.6/src/_core.o -std=c++17 -fvisibility=hidden -DECVL_WITH_DICOM -DECVL_WITH_OPENSLIDE -DECVL_EDDL g++ -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-3.6/src/_core.o -L/usr/lib64 -ldataset_parser -lecvl_core -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lstdc++fs -lyaml-cpp -ldcmdata -ldcmimage -ldcmimgle -ldcmjpeg -li2d -lijg8 -lijg12 -lijg16 -loflog -lofstd -lopenslide -lecvl_eddl -leddl -lpython3.6m -o build/lib.linux-x86_64-3.6/pyecvl/_core.cpython-36m-x86_64-linux-gnu.so running install_lib copying build/lib.linux-x86_64-3.6/pyecvl/_core.cpython-36m-x86_64-linux-gnu.so -> /usr/lib64/python3.6/site-packages/pyecvl running install_egg_info Removing /usr/lib64/python3.6/site-packages/pyecvl-0.0.0-py3.6.egg-info Writing /usr/lib64/python3.6/site-packages/pyecvl-0.0.0-py3.6.egg-info

Fail import pyecvl._core

` [perlo@escher pyecvl]$ python3 Python 3.6.7 (default, Dec 5 2018, 15:02:05) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux Type "help", "copyright", "credits" or "license" for more information.

import pyecvl import pyecvl._core Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'pyecvl._core' `

simleo commented 4 years ago

Hi. You have to move to a different directory (e.g., cd tests) for the import to succeed. In the top level of the source the import fails, because that directory contains a subdirectory named pyecvl that takes priority over the installation directory.

PerloDaniele commented 4 years ago

Many thanks, It works. It shows also ImportError: libopencv_imgcodecs.so.4.2: cannot open shared object file: No such file or directory fixed by properly set $LD_LIBRARY_PATH

However, pytest pyecvl/tests/test_imgproc.py ends in 'Segmentation Fault'

[perlo@escher ~]$ pytest pyecvl/tests
=========================================================================================== test session starts ============================================================================================
platform linux -- Python 3.6.7, pytest-5.3.3, py-1.8.1, pluggy-0.13.1
rootdir: /home/perlo/pyecvl
collected 38 items      
pyecvl/tests/test_arithmetic.py ...                                                                                                                                                                  [  7%]
pyecvl/tests/test_datatype.py ..                                                                                                                                                                     [ 13%]
pyecvl/tests/test_eddl.py ...                                                                                                                                                                        [ 21%]
pyecvl/tests/test_image.py ............                                                                                                                                                              [ 52%]
pyecvl/tests/test_imgproc.py Fatal Python error: Segmentation fault
Current thread 0x00007f18f0e6d740 (most recent call first):
  File "/home/perlo/pyecvl/tests/test_imgproc.py", line 10 in test_ResizeDim
  File "/usr/lib/python3.6/site-packages/_pytest/python.py", line 167 in pytest_pyfunc_call
  File "/usr/lib/python3.6/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/lib/python3.6/site-packages/pluggy/manager.py", line 87 in <lambda>
  File "/usr/lib/python3.6/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/lib/python3.6/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/lib/python3.6/site-packages/_pytest/python.py", line 1445 in runtest
  File "/usr/lib/python3.6/site-packages/_pytest/runner.py", line 132 in pytest_runtest_call
  File "/usr/lib/python3.6/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/lib/python3.6/site-packages/pluggy/manager.py", line 87 in <lambda>
  File "/usr/lib/python3.6/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/lib/python3.6/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/lib/python3.6/site-packages/_pytest/runner.py", line 208 in <lambda>
  File "/usr/lib/python3.6/site-packages/_pytest/runner.py", line 235 in from_call
  File "/usr/lib/python3.6/site-packages/_pytest/runner.py", line 208 in call_runtest_hook
  File "/usr/lib/python3.6/site-packages/_pytest/runner.py", line 183 in call_and_report
  File "/usr/lib/python3.6/site-packages/_pytest/runner.py", line 97 in runtestprotocol
  File "/usr/lib/python3.6/site-packages/_pytest/runner.py", line 82 in pytest_runtest_protocol
  File "/usr/lib/python3.6/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/lib/python3.6/site-packages/pluggy/manager.py", line 87 in <lambda>
  File "/usr/lib/python3.6/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/lib/python3.6/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/lib/python3.6/site-packages/_pytest/main.py", line 270 in pytest_runtestloop
  File "/usr/lib/python3.6/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/lib/python3.6/site-packages/pluggy/manager.py", line 87 in <lambda>
  File "/usr/lib/python3.6/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/lib/python3.6/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/lib/python3.6/site-packages/_pytest/main.py", line 246 in _main
  File "/usr/lib/python3.6/site-packages/_pytest/main.py", line 196 in wrap_session
  File "/usr/lib/python3.6/site-packages/_pytest/main.py", line 239 in pytest_cmdline_main
  File "/usr/lib/python3.6/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/lib/python3.6/site-packages/pluggy/manager.py", line 87 in <lambda>
  File "/usr/lib/python3.6/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/lib/python3.6/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/lib/python3.6/site-packages/_pytest/config/__init__.py", line 93 in main
  File "/bin/pytest", line 10 in <module>
Segmentation fault

cause of ecvl.ImRead

>>> import pyecvl._core.ecvl as ecvl
>>> img = ecvl.Image()
>>> ecvl.ImRead('target_500.jpg',img)
Segmentation fault
simleo commented 4 years ago

ecvl.ImRead is just a wrapper around the C++ ecvl::ImRead that, in turn, calls cv::imread. So this could be an opencv problem, or perhaps that specific image is corrupted in some way. Anyway, try opening the same image in a C++ ECVL program and see what happens.