Home > Mobile >  Django doesn't find Pillow "Cannot use ImageField because Pillow is not installed." W
Django doesn't find Pillow "Cannot use ImageField because Pillow is not installed." W

Time:01-10

I installed Pillow successfully inside of the venv (virtual environment). but I still get the same Error when starting the server.

D:\Commerce>python manage.py runserver

django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:

ERRORS:
auctions.listings.photo: (fields.E210) Cannot use ImageField because Pillow is not installed.
        HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".

System check identified 1 issue (0 silenced).

I have Python version 3.11.1 installed.

Pillow Version Support

in an activated venv I checked for:

pip --version

pip 22.3.1 from D:\Commerce\venv\Lib\site-packages\pip (python 3.11)

The Installation Directory of Django and Pillow are the same as you can see below. And both are updated to the newest version.

pip show django
Name: Django
Version: 4.1.5
Summary: A high-level Python web framework that encourages rapid development and clean, pragmatic design.
Home-page: https://www.djangoproject.com/
Author: Django Software Foundation
Author-email: [email protected]
License: BSD-3-Clause
Location: D:\Commerce\venv\Lib\site-packages
Requires: asgiref, sqlparse, tzdata
Required-by:
pip show Pillow
Name: Pillow
Version: 9.4.0
Summary: Python Imaging Library (Fork)
Home-page: https://python-pillow.org
Author: Alex Clark (PIL Fork Author)
Author-email: [email protected]
License: HPND
Location: D:\Commerce\venv\Lib\site-packages
Requires:
Required-by:

I tried

pip uninstall Pillow
pip install Pillow

and

pip uninstall Pillow
python -m pip install Pillow

I updated Python, Django, PIP and Pillow.

Python via the installer from the Website. https://www.python.org/downloads/

Django via

python -m pip install -U Django

PIP via

python -m pip install --upgrade pip

and Pillow via

python -m pip install --upgrade Pillow

CodePudding user response:

Finally, I had to start the server inside the venv (virtual environment). Not sure why (it always worked outside the venv before). But somehow after installing Pillow it only works inside the venv.

start the venv via:

project-name\Scripts\activate.bat

in my case project-name is venv and then run the server via:

python manage.py runserver

This is what worked for me... After 2 hours of trying. I hope, at least this helps someone else.

  • Related