Python Forum
No module named 'Pillow' - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: No module named 'Pillow' (/thread-18247.html)



No module named 'Pillow' - MrMajorThorburn - May-10-2019

I get the message ModuleNotFoundError: No module named 'Pillow'
I get the following from pip show Pillow
Name: Pillow
Version: 5.4.1
Summary: Python Imaging Library (Fork)
Home-page: http://python-pillow.org
Author: Alex Clark (Fork Author)
Author-email: [email protected]
License: Standard PIL License
Location: c:\users\major\appdata\roaming\python\python37\site-packages
Requires:
Required-by: anki-vector
I am trying to run a python file that uses anki_vector.
I have re-installed python and confirm I have a PYTHONPATH environment variable containing the paths to the installed python DLLs and Lib folders.
Do I need to add the path to the site-packages in my user area?


RE: No module named 'Pillow' - Yoriz - May-10-2019

Although it's called pillow you import PIL
https://pillow.readthedocs.io/en/stable/handbook/tutorial.html


RE: No module named 'Pillow' - MrMajorThorburn - May-10-2019

Ok thanks.
I asked as I got a Cannot import from PIL and to do a pip3 install Pillow and thought I would be able to do a quick test of Import Pillow.

Now all I have to do is find out which py file the failing Import is in.


RE: No module named 'Pillow' - snippsat - May-10-2019

(May-10-2019, 01:27 PM)MrMajorThorburn Wrote: I have re-installed python and confirm I have a PYTHONPATH environment variable containing the paths to the installed python DLLs and Lib folders.
Look as this to make sure all is correct Python 3.6/3.7 and pip installation under Windows

A basic test of python and pip from command line.
C:\>python -V
Python 3.7.3

C:\>python -c "import sys; print(sys.executable)"
C:\python37\python.exe

# See that pip point to 3.7
C:\>pip -V
pip 19.1.1 from c:\python37\lib\site-packages\pip (python 3.7)
So now will pip install Pillow only install to Python 3.7.
A quick test i use virtual environment as a already have Pillow installed before.
# Install 
(key_env) E:\div_code\key_env
λ pip install Pillow
Collecting Pillow .....
Installing collected packages: Pillow
Successfully installed Pillow-6.0.0

# Test
(key_env) E:\div_code\key_env
λ python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
# The import is still PIL as mention before
>>> from PIL import Image
>>> Image.__version__
'6.0.0'

>>> im = Image.open("22.jpg")
>>> print(im.format, im.size, im.mode)
JPEG (930, 288) RGB
>>> exit()



RE: No module named 'Pillow' - MrMajorThorburn - May-11-2019

Ok. thanks for that.
I am now sorted.
I used grep to find the file(s) that showed me the message about import PIL and have downloaded and installed the latest version of the associated package(s) and I now get to the actual messages from the py file I was testing so I am good to move on now.