cgohlke / imagecodecs

Image transformation, compression, and decompression codecs
https://pypi.org/project/imagecodecs
BSD 3-Clause "New" or "Revised" License
111 stars 21 forks source link

could not import name 'jetraw_decode' from 'imagecodecs' #66

Closed gil-c closed 1 year ago

gil-c commented 1 year ago

Hello,

I tried to read an image compressed with jetraw, but I have the following error message:

imagecodecs.imagecodecs.DelayedImportError: could not import name 'jetraw_decode' from 'imagecodecs'

I am using imagecodecs 2023.3.16 from Pypi on Windows x64.

Should I install something else (e.g. jetraw binaries)?

cgohlke commented 1 year ago

Install jetraw 22.02.16.1 and copy the jetraw.dll and dpcore.dll files next to the python.exe.

gil-c commented 1 year ago

Thanks a lot @cgohlke for your quick answer.

Unfortunately it didn't work. I installed the JetrawWithDPCore-22.02.16.1.msi and copied the 2 dlls next to python.exe in my Python virtual environment folder.

In addition I also added "C:\Program Files\Jetraw\bin64" in the Path variable as explained in the README.md from jetraw repo.

I still have the same Import Error.

cgohlke commented 1 year ago

That should have worked. Note that imagecodecs requires the Visual C++ redistributable. Also make sure it's the right python.exe.

Instead of copying the DLLs, adding a call to os.add_dll_directory(r'C:\Program Files\Jetraw\bin64') before importing imagecodecs should also work.

gil-c commented 1 year ago

It worked! The os.add_dll_directory did the trick. Thank you very much for your help, and for all the work you put into developing this wonderful library.