Pillow: libopenjp2.so.7: cannot open shared object file: No such file or directory

Simon Carlson picture Simon Carlson · Dec 28, 2017 · Viewed 13.4k times · Source

I have a fresh, minimal Raspbian Stretch install. I have installed the PIXEL-dekstop by running sudo apt-get install --no-install-recommends xserver-xorg and am now trying to use Pillow in Python. Pillow was installed by running sudo apt-get install pip3 and then sudo pip3 install Pillow. Whenever I try from PIL import Image I get the error ImportError: libopenjp2.so.7: cannot open shared object file: No such file or directory.

I have attempted to reinstall Pillow under different versions but it does not help. I have also enabled apt-get sources in /etc/apt/sources.txt and ran sudo apt-get build-dep python-imaging, which also did not help. Any help is appreciated.

Python version: 3.5.3, current Pillow version: 4.3.0

Answer

Paulo Cirino picture Paulo Cirino · May 29, 2018

What worked for me was running :

sudo apt-get install libopenjp2-7

Good Luck!