When I run this in the terminal it imports without an error:
from PIL import Image
When I run the same code in my Flask app running over Apache/WSGI, it causes an error:
cannot import name '_imaging' from 'PIL' (/var/www/app/env/lib/python3.9/site-packages/PIL/__init__.py)
I installed Pillow
into the virtual environment correctly. I did not install the older PIL package and have checked a dozen times to make sure it's not installed and causing a conflict.
I installed WSGI for Python 3 like this:
sudo apt-get install libapache2-mod-wsgi-py3
EVERYTHING about the app, including all other Python modules/dependencies has been running just fine for months. Pillow
is the only one that doesn't work in the deployed app, but does work when run from the terminal.
My Apache configuration file includes this reference to the virtual environment location:
WSGIPythonHome "/var/www/app/env"
I've tried older versions of Pillow
with no success. I've tried uninstalling and reinstalling Pillow
. I've tried nuking my virtual environment and creating it again from scratch. Kind of at a loss here.