pydicom/pylibjpeg-openjpeg

fail to install/run openjpeg

Borda opened this issue · 3 comments

Borda commented

I am running Kaggle kernel with pydicom and failing on decompress some images, so I got to the point I know I need to manually decompress images, but then it seems to fail with come compatibility with numpy...

pip install -q pylibjpeg-libjpeg
pip install -qU "pylibjpeg==1.2" pylibjpeg-openjpeg --no-binary :all:

so I see installed:

pylibjpeg                      1.2.0
pylibjpeg-libjpeg              1.2.0
pylibjpeg-openjpeg             1.1.1

then calling import openjpeg fails with

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-66-80c0acc2a717> in <module>
      1 import pylibjpeg
      2 from pylibjpeg.pydicom.utils import get_pixel_data_decoders
----> 3 import openjpeg

/opt/conda/lib/python3.7/site-packages/openjpeg/__init__.py in <module>
      2 
      3 from ._version import __version__
----> 4 from .utils import decode, decode_pixel_data, get_parameters

/opt/conda/lib/python3.7/site-packages/openjpeg/utils.py in <module>
      5 import warnings
      6 
----> 7 import _openjpeg
      8 
      9 

/opt/conda/lib/python3.7/site-packages/openjpeg/_openjpeg.pyx in init _openjpeg()

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

Hmm, from memory this is usually fixed by reinstalling numpy

Borda commented

Hmm, from memory this is usually fixed by reinstalling numpy

that is what I tried too even building numpy from source but still somehow failing and it was hard to debug
in fact, I was able to get it run on my local Linux machine not on Kaggle kernel 😕

You could try re-building pylibjpeg-openjpeg instead of using the wheel: pip install git+https://github.com/pydicom/pylibjpeg-openjpeg.git@v1.1.1 , which should use the same numpy version from Kaggle (I think)