Forums

No module named 'PIL'

I am getting following ERROR when i am uploading image in admin. This same code is running on my computer without any error. Any solutions?? Thanks in Advanced... :)

ImportError at /admin/jspmisnew/student/96/ No module named 'PIL' Request Method: POST Request URL: http://jspmis.pythonanywhere.com/admin/jspmisnew/student/96/ Django Version: 1.8.5 Exception Type: ImportError Exception Value:
No module named 'PIL' Exception Location: /home/jspmis/.virtualenvs/django18/lib/python3.4/site-packages/django/forms/fields.py in to_python, line 674 Python Executable: /usr/local/bin/uwsgi Python Version: 3.4.0 Python Path:
['/var/www', '.', '', '/var/www', '/home/jspmis/.virtualenvs/django18/lib/python3.4', '/home/jspmis/.virtualenvs/django18/lib/python3.4/plat-x86_64-linux-gnu', '/home/jspmis/.virtualenvs/django18/lib/python3.4/lib-dynload', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu', '/home/jspmis/.virtualenvs/django18/lib/python3.4/site-packages', '/home/jspmis/mis'] Server time: Tue, 17 Nov 2015 09:20:21 +0000

Do you have PIL installed in your virtualenv?

YUP it seems in python 3.4 console, I do have PIL installed but in virtualenv it was not installed. Thanks I have installed pillow, and it solved the problem. THANKS once again!! :)

pip install pillow

thank you very much, it works for me as well

Thanks for confirming that!

I am facing the same problem but with pillow installed in my virtual environment (Python 10, matplotlib 3.8.2 which imports pillow, and pillow 10.0.1). Importing works fine on my local machine. Log: File "/home/gunnibaba/.virtualenvs/django-polls-virtualenv/lib/python3.10/site-packages/matplotlib/colors.py", line 52, in <module> 2023-12-08 02:48:46,437: from PIL import Image 2023-12-08 02:48:46,816: ModuleNotFoundError: No module named 'PIL'

(django-polls-virtualenv) 01:10 ~/seismicscience (deployed)$ pip freeze asgiref==3.7.2 contourpy==1.2.0 cycler==0.12.1 Django==4.2.5 django-debug-toolbar==4.2.0 fonttools==4.46.0 kiwisolver==1.4.5 matplotlib==3.8.2 mypythonutils==1.0.1 numpy==1.26.2 packaging==23.2 Pillow==10.1.0 pyparsing==3.1.1 python-dateutil==2.8.2 six==1.16.0 sqlparse==0.4.4 typing_extensions==4.8.0

Solved. One has to reload the web app after installing python packages.

Yes, that's right. Glad you were able to solve it.