Heroku PIL ModuleNotFoundError: No module named 'Image' - python

I am creating a Heroku app in which I am using PIL and from PIL import Image.
When I run heroku local, it returns ModuleNotFoundError: No module named 'Image'. I have tried using Pillow instead of PIL, but it returns the same error. PIL and Pillow are both in my requirements.txt.
A link to my full github repo is: https://github.com/maivey/flower-image-classifier
Please help as I do not understand why it will not recognize PIL or Pillow

Maybe you need to install them.
If you use anaconda: conda install PIL
If you use pip: pip install PIL
Thanks

Related

Why PIL is not working on miniconda python 3.9?

from PIL import image
ImportError: cannot import name 'image' from 'PIL' (<path>9/lib/python3.9/site-packages/PIL/__init__.py)
pip install, conda install all tested.
May anyone experienced same thing?
Use this instead
from PIL import Image
for additional help please refer this - https://pillow.readthedocs.io/en/stable/reference/Image.html
just update the packages and resolved!

Why do I get an error trying to use pytesseract?

import pytesseract
import PIL
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
Im trying that code alone with many other ways to type the pile path as in double '\' etc but I still continue to get the error:
ModuleNotFoundError: No module named 'PIL'
In shell, run:
pip install Pillow
The error means you are missing some modules.
pip install --upgrade --force-reinstall Pillow
resolved my issue

Unable to import PIL into project

The PIL module should be installed because when I run the pip install pillow I get this message: Requirement already satisfied: pillow in [my installation route]. But, when I try to import this into a file, I get this error:
ModuleNotFoundError: No module named 'Pillow'
What am I doing wrong?
this has worked for me if your using vscode try install by typing py -m pip install pillow
from PIL import ImageTk,Image
Pillow is a fork of PIL, and the import is carried over.
import PIL
Should do the trick. The documentation has additional details:
https://pillow.readthedocs.io/en/stable/installation.html

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

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