Closed Coolgamerguy4793 closed 4 years ago
How did you install Pillow?
I installed it from pip
Did you run pip install Pillow
, or are you saying that you ran pip install PIL
? If you ran pip install PIL
, then you should know that PIL does not support Python 3, so that will not ultimately work for you.
I presume you did not try and build Pillow from source.
Could you post the output of the following code?
import PIL
print(PIL)
Also, be aware of the documented instructions for installing Pillow using pip - https://pillow.readthedocs.io/en/latest/installation.html#windows-installation
python -m pip install --upgrade pip
python -m pip install --upgrade Pillow
Googling, I found suggestions that you might have PIL installed alongside Pillow. Could you try uninstalling Pillow, checking that you can no longer import PIL
, and then re-installing Pillow?
I presume that you haven't created a script named PIL.py that could be interfering.
Having the same issue here, however I am pretty sure that they aren't installed side by side, with proof here:
@HTG-YT what operating system are you using? How did you install Pillow?
Could you post the output of the following code?
import PIL
print(PIL)
My operating system is Windows 10 Home.
The output of the code is as below:
@radarhere and I got that via pip install Pillow
and this is the traceback:
Traceback (most recent call last):
File "C:\Users\85251\PycharmProjects\HarTex discord.py\venv\lib\site-packages\discord\ext\commands\bot.py", line 596, in _load_from_module_spec
spec.loader.exec_module(lib)
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\85251\PycharmProjects\HarTex discord.py\cmds\levelling_system.py", line 12, in <module>
from PIL import Image, ImageDraw, ImageFont
File "C:\Users\85251\PycharmProjects\HarTex discord.py\venv\lib\site-packages\PIL\Image.py", line 69, in <module>
from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (C:\Users\85251\PycharmProjects\HarTex discord.py\venv\lib\site-packages\PIL\__init__.py)
So with the traceback I wonder if it is a problem of the PIL package.
That doesn't seem to work in the built-in terminal of PyCharm
Did that miniconda3
mean I have to install external stuff to my computer?
I am getting the same error. I'm using virtual env - how is it resolved without miniconda?
I don't want to suggest that you have to use miniconda, I'm just attempting to provide another situation in the hope that it will help and lead you towards a solution. https://stackoverflow.com/questions/55419368/in-pycharm-importerror-dll-load-failed-the-specified-module-could-not-be-found, for example, is a person who has a similar problem to this, with Anaconda, and resolves it by adding the interpreter to PyCharm. So maybe the interpreter settings could be a solution here?
Well after I updated to newer version so pip, the problem is resolved.
@HTG-YT I would like to know in which environment the problem was solved. I also tried to use the built code in the project.
I am using pycharm and I installed pillow from the settings,the version in 7.2.0. I am facing the same problem and after i type import PIL print(PIL) i get this: <module 'PIL' from 'C:\Users\Prottoy Mobin\PycharmProjects\python_1\venv\lib\site-packages\PIL\init.py'> I am new in programming,please help me solve this issue.
The solution for @HTG-YT was to upgrade pip, so you might try
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
Same issue here: ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/__init__.py)
when using scikit-image
(Pillow 7.0). Upgraded to 8.0.1 and it works.
I'm getting this error on a Mac after running
brew install python@3.8
pip install Pillow
Then
from PIL import images
This fails with the line
ImportError: cannot import name '_imaging' from 'PIL' (/usr/local/lib/python@3.8/PIL/__init__.py
The Pillow version is 8.2
I also tried this with conda and with:
conda activate test-driver
conda install Pillow
But when running this I get Pi
import PIL
PIL.__version__
from PIL import Images
I get nearly the same error
>>> PIL.__version__
'8.1.0'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Images' from 'PIL' (/usr/local/Caskroom/miniconda/base/envs/test-driver/lib/python3.8/site-packages/PIL/__init__.py)
So did something change with Pillow v8.1.0?
from PIL import images from PIL import Images
For one thing, these are incorrect. It is from PIL import Image
Yes that was problem, I just realized. I'm an idiot!!!
Sent via Superhuman ( https://sprh.mn/?vip=rich@tongfamily.com )
On Thu, Feb 04, 2021 at 2:26 PM, Andrew Murray < notifications@github.com > wrote:
from PIL import images from PIL import Images
For one thing, these are incorrect. It is from PIL import Image
— You are receiving this because you commented. Reply to this email directly, view it on GitHub ( https://github.com/python-pillow/Pillow/issues/4416#issuecomment-773643841 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AANTCR2AFCHZEVFGHTXVBTTS5MNIRANCNFSM4KTHXX3Q ).
PyPy3 enjoyer is here. Environment: Windows 10 x64 under VMWare Player. Installation was:
choco install make pypy3
pypy3 -m ensurepip
pypy3 -m pip install pillow
Python 3.7.10 (51efa818fd9b, Apr 04 2021, 12:09:32)
[PyPy 7.3.4 with MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>> import PIL
>>>> print(PIL)
<module 'PIL' from 'C:\\Users\\Ivan Stepanov\\AppData\\Roaming\\PyPy\\PyPy37\\site-packages\\PIL\\__init__.py'>
>>>> from PIL import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ivan Stepanov\AppData\Roaming\PyPy\PyPy37\site-packages\PIL\Image.py", line 114, in <module>
from . import _imaging as core
ImportError: cannot import name '_imaging'
Did you want to try
pypy3 -m pip install --upgrade pip
pypy3 -m pip install --upgrade Pillow
I am also facing an same issue but i solved it using these below references -
Installations of PIL on windows 10 https://www.geeksforgeeks.org/how-to-install-pil-on-windows/
Tutorials of pillow https://pillow.readthedocs.io/en/stable/handbook/tutorial.html
pip install pillow
Requirement already satisfied: pillow in c:\users\admin\anaconda3\lib\site-packages (8.4.0) Note: you may need to restart the kernel to use updated packages.
pip install PIL
Note: you may need to restart the kernel to use updated packages.
ERROR: Could not find a version that satisfies the requirement PIL (from versions: none) ERROR: No matching distribution found for PIL
import PIL
print(PIL)
PIL.__version__
<module 'PIL' from 'C:\Users\Admin\anaconda3\lib\site-packages\PIL\init.py'>
'8.4.0'
conda install -c anaconda Pillow
Collecting package metadata (current_repodata.json): ...working... done Solving environment: ...working... done
Note: you may need to restart the kernel to use updated packages.
PIL.__version__
from PIL import Image
#make sure i should be caps in Image
Im = Image.open('53220.jpg')
type(Im)
Im
#It will showing an image
Im.show()
Im.size
#It will shows the size of an image
Mere pip --upgrade
no longer reinstalls.
pip install --force-reinstall pillow
fixed it for me.
pip install --force-reinstall pillow fixed it for me.
That worked here too. Somehow conda's version isn't working (I had pillow 9.4.0, same error)
+1 pip install --force-reinstall pillow worked also for my config: ubuntu 22.04LTS python 3.11.2 pip 23.0.1
What did you do?
Tried to run: from PIL import Image
What did you expect to happen?
To get access to the Image package contained in PIL
What actually happened?
I got the error:
What are your OS, Python and Pillow versions?