Anarc
Anarc

Reputation: 53

Pillow, OpenJPEG (for jpeg2000) and anaconda

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?

Upvotes: 3

Views: 1651

Answers (2)

Bruce Seymour
Bruce Seymour

Reputation: 1598

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/

Upvotes: 0

Dr. Fabien Tarrade
Dr. Fabien Tarrade

Reputation: 1706

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.

Upvotes: 0

Related Questions