3

I'm trying to save an image with JPEG2000 from pillow, but get the dreaded OSError: encoder jpeg2k not available.

Now following the instructions in pillow's docs, I installed OpenJPEG. I tried both from conda-forge and following their installation guide.

After each try I uninstalled, cleaned the conda cache, and reinstalled pillow:

conda uninstall pillow -y && conda clean -a -y && conda install pillow -y

The problem persists. I'm running Ubuntu 20.04.1 on Window's WSL2.

I'd prefer running OpenJPEG from anaconda, to keep the project workable off of the environment.yml alone.

What am I missing?

Anarc
  • 53
  • 1
  • 6
  • I would [file an issue on Conda Forge's pillow-feedstock](https://github.com/conda-forge/pillow-feedstock/issues). I'm a bit confused that [their `build.sh`](https://github.com/conda-forge/pillow-feedstock/blob/master/recipe/build.sh) has a commented out line for JPEG2K. I'm not familiar with the compilation details for `pillow`, but `pillow` may need to know about the availability of a JPEG2K library during installation. The feedstock authors may also be interested in knowing that JPEG2K support isn't working out-of-the-box. – merv Dec 21 '20 at 22:52

2 Answers2

0

Same issue. I am using Ubuntu 18.04.5 LTS. Using openjpeg=2.4.0 openjpeg and Pillow=8.1.0 with Python 3.7.6 didn't solve the issue (latest version of the packages).

I had to install low level libraries:

sudo apt-get update -y
sudo apt-get install -y libopenjp2-7 libopenjp2-7-dev

Then I recreated the conda env and it worked.

Dr. Fabien Tarrade
  • 1,556
  • 6
  • 23
  • 49
0

To install OpenJpeg on Mac, you can use Mac Ports:

sudo port install openjpeg

To install libjpeg on Mac OSX use Brew:

brew install jpeg

Mac Ports can be installed here: https://www.macports.org/

Brew can be installed here: https://brew.sh/

Bruce Seymour
  • 1,520
  • 16
  • 24