In Django project, Python says Pillow is not installed but it is installed

Question:

After upgrading Python 3.8 to 3.9 this error has happened and says pillow is not installed. I tried to uninstall and reinstall pillow, but it did not worked.

I’m using Django 3.1 on a Windows 10 pro.

The output of pip freeze is attached too.

Here is the error message:

ERRORS:

magazine.Magazine.image: (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".
post.Posts.image: (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".
post.Sample.image: (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".
post.Workers.avatar: (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".
product.Products.image: (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".

enter image description here
enter image description here

Asked By: H4mid Hosseini

||

Answers:

1.Activate the virtual environment (your env path).Scriptsactivate
2.Run the Django application

This will work.

Answered By: Kenneth Githambo

It’s warning because old version of pip was renaming folders that it could not delete, replacing first letter with tilda ~.

In your C:..python38-32libsite-packages have a folder named ~illow....

When I delete that folder and reinstall python -m pip Pillow, it’s worked.

I have same error and this post solved problem.

Answered By: Nguyễn Vũ Thiên

Make sure you don’t have any Pillow or PIL folder (older version) in your main project directory, as this will cause conflicts if you have Pillow installed in a virtual environment or in the PythonXX folder.

If you are using the virtual environment, you will need to re-install pillow. But do not run "pip uninstall Pillow" before you activate the virtual environment.

Remove any older versions of Pillow if you had manually put them in your project folder. Activate the virtual environment, then uninstall, and then install it again.

env/Scripts/activate.ps1

pip uninstall Pillow

python -m Pip install Pillow
Answered By: Conor