ImportError: No module named Image [duplicate] - python

This question already has answers here:
The problem with installing PIL using virtualenv or buildout
(4 answers)
Closed 6 years ago.
I have also tried
from PIL import Image
but it gives me ImportError: No module named PIL.
I have installed PIL successfully using
pip install pil
and I've also installed xcode command line tools. Nothing seem to work.
Details:
Mac OS X 10.9
Python 2.7.6
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
python is /usr/bin/python
python is /usr/local/bin/python
Name: PIL
Version: 1.1.7
Location: /usr/local/lib/python2.7/site-packages/PIL

The PIL distribution is mispackaged for egg installation.
Install Pillow instead, the friendly PIL fork.

On a system with both Python 2 and 3 installed and with pip2-installed Pillow failing to provide Image, it is possible to install PIL for Python 2 in a way that will solve ImportError: No module named Image:
easy_install-2.7 --user PIL
or
sudo easy_install-2.7 PIL

Related

ModuleNotFoundError: No module named 'PIL' error [duplicate]

This question already has answers here:
Python program works only from pycharm, not somewhere else
(3 answers)
Closed 10 months ago.
To use the pillow module I wrote down the command:
pip install pillow
And in the file to use I wrote:
from PIL import Image
But I get the error:
ModuleNotFoundError: No module named 'PIL'
what can I do?
Install pillow by writing pip install Pillow in your terminal. (P in Pillow is capitalised )
Then you can call the image library using: from PIL import Image (PIL in all capital and Image is capitalised)

Library Pillow - cannot import name '_imaging' from 'PIL' - ERROR [duplicate]

This question already has answers here:
Cannot import name '_imaging' from 'PIL'
(3 answers)
Closed 2 years ago.
I am having problems with the module PIL/Pillow. I installed it with pip install pillow and everything worked fine. But when I start a program that needs this module, it recognizes it, but shows the following error message: ImportError: cannot import name '_imaging' from 'PIL' (see picture).
from PIL import Image
[Click to see the Pic with the Error]
See also these pictures:
Script-Code
Image.py
It seems that many have this problem, but I have not found a solution to my problem anywhere. Neither in the forum nor in Google. How do I fix this?
Python version: 3.8.2
Pillow version: 8.1.0
This can happen because you have PIL and Pillow installed. Pillow is a fork of PIL and is the maintained library. It is recommended not to use PIL because it has become outdated. Here are the steps to fix the problem:
pip uninstall PIL
pip uninstall pillow
then:
pip install pillow
If this doesn't solve the problem, go into your python site-packages or dist-packages and remove any files or folders related to PIL or pillow, then:
pip install pillow

ImportError: No module named PIL python 2.7.10

I am not able to import PIL on macOS, it works fine on windows with python version 2.7.16.
Any help for python 2.7.10 would be much appreciated.
from PIL import Image
ERROR:-
ImportError: No module named PIL
I am getting this error with python (2.7.10) pip(19.1.1) on macos Mojave (10.14.4)
pip list outputs pillow in the packages version (5.2.0)
pip install pillow
Logs the following:
Requirement already satisfied: pillow in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (5.2.0)
But i am still unable to import the package.
Any workarounds for this?

Pillow has already installed, but appears ImportError - Python3.5 Ubuntu [duplicate]

This question already has an answer here:
Pillow installed, but getting "no module named pillow" when importing
(1 answer)
Closed 6 years ago.
I used sudo pip3 to install Pillow in Python 3.5 (without sudo it will prompt PermissonError) and it said
Requirement already satisfied (use --upgrade to upgrade): Pillow in /usr/local/lib/python3.5/dist-packages
But when I tried to use it in the Program. It shows:
File "./level7.py", line 4, in <module>
from Pillow import Image
ImportError: No module named 'Pillow'
My first few lines in my program are:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
from Pillow import Image
Besides, I found that in /home/-uname/.local/lib file, there is a Python2.7 file, but no Python3.5.
What's the relation between /usr/local and /home/-uname/.local? And how to fix this problem?
Based off of the documentation for Pillow, you are actually supposed to import it as:
from PIL import Image

No module named Image

Sorry for my grammar, I don't speak English.
After I set filebrowser, tinymce, and grappelli, I get this error: No module named Image
try:
from PIL import Image
except ImportError:
import Image
I set it to PIL but it didn't solve the problem.
my platform windows
If i want: pip install PIL
`c:\Users\Kim\BitNami DjangoStack projects\homex8>pip install PIL
Downloading/unpacking PIL
Running setup.py egg_info for package PIL
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
Installing collected packages: PIL
Running setup.py install for PIL
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
building '_imaging' extension
error: Unable to find vcvarsall.bat`
I do not understand what that means
Solved problem.
reinstall PIL with easy_install, and more movements, here are the details.
You are missing PIL (Python Image Library and Imaging package). To install PIL I used
pip install pillow
For my machine running Mac OSX 10.6.8, I downloaded Imaging package and installed it from source.
http://effbot.org/downloads/Imaging-1.1.6.tar.gz and cd into Download directory. Then run these:
$ gunzip Imaging-1.1.6.tar.gz
$ tar xvf Imaging-1.1.6.tar
$ cd Imaging-1.1.6
$ python setup.py install
Or if you have PIP installed in your Mac
pip install http://effbot.org/downloads/Imaging-1.1.6.tar.gz
then you can use:
from PIL import Image
in your python code.
Did you setup PIL module? Link
You can try to reinstall it on your computer.
It is changed to : from PIL.Image import core as image
for new versions.
You can this query:
pip install image
I had pillow installed, and still, I got the error that you mentioned. But after I executed the above command, the error vanished. And My program worked perfectly.
Problem:
~$ simple-image-reducer
Traceback (most recent call last):
File "/usr/bin/simple-image-reducer", line 28, in <module>
import Image
**ImportError: No module named Image**
Reason:
Image != image
Solution:
1) make sure it is available
python -m pip install Image
2) where is it available?
sudo find ~ -name image -type d
-->> directory /home/MyHomeDir/.local/lib/python2.7/site-packages/image
->> OK
3) make simple-image-reducer understand via link:
ln -s ~/.local/lib/python2.7/site-packages/image
~/.local/lib/python2.7/site-packages/Image
4)
invoke simple-image-reducer again.
Works:-)
If you are trying to just show the image on your notebook, below simply does the job
from IPython.display import Image
Image(url= "Link to the image ending with file format such as, .jpg or .png")

Categories

Resources