I'm new to Python and I have a problem with Pillow (as many people before me).
Running the command below:
from PIL import Image
causes a known error:
ModuleNotFoundError: No module named 'PIL'
The problem occurs when I try to run it with Python 3.6, everything works fine with Python 3 however I have to use version 3.6 in my project.
Pillow version: 4.3.0, so it is compatible with this Python version.
Why does this not work on the newer version?
I had to install pillow for 3.6 python: python3.6 -m pip install pillow
PIL and Python compatibility issue. See for example (http://pillow.readthedocs.io/en/5.1.x/installation.html ).
pipX search Pillow -> shows which version is installed and available.
Better to use Python virtual environment to avoid compatibility issues.
pip uninstall Pillow
pip uninstall PIL
pip install Pillow
Source
C:\python>pip install pillow
Collecting pillow
Downloading https://files.pythonhosted.org/packages/4e/d9/468422371e6fcf02d6a162ee30db4552221de8b2b3ff837363bf54cbb347/Pillow-6.1.0-cp36-cp36m-win_amd64.whl (2.0MB)
100% |████████████████████████████████| 2.0MB 3.2MB/s
Installing collected packages: pillow
Successfully installed pillow-6.1.0
You are using pip version 18.1, however version 19.2.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Related
I am using windows
import cv2
ModuleNotFoundError: No module named 'cv2'
how to fix it?
I tried
pip install opencv-contrib-python
pip3 install opencv-python
pip install opencv-python
etc etc, still did not work
update: cv2 is fixed, but I am having a problem on mediapipe.
it's showing like this:
ERROR: Could not find a version that satisfies the requirement mediapipe (from versions: none)
ERROR: No matching distribution found for mediapipe
WARNING: You are using pip version 21.3.1; however, version 22.3.1 is available.
You should consider upgrading via the 'E:\python\Scripts\python.exe -m pip install --upgrade pip' command.
my python version is 3.11.0
It seems the install of cv2 goes nicer with system install: apt install python3-opencv
I think, with Python 3.11.0 we can't install mediapipe. What I suggest you is to try lowering your Python version to 3.7.0 and install mediapipe. If you face the same issue then try installing mediapipe==0.8.9
ERRORS:
core.Item.image: (fields.E210) Cannot use ImageField because Pillow is not installed.
HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "pip install Pillow".
since I was installed pillow
when I run the pip install pillow command It shows the requirement already satisfied.
please give me a solution
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
I want to install OpenCV 3.4.0 on Ubuntu 16.04. I tried to build from source following tutorial on internet but run to this problem:
ImportError:
/home/ivan/.virtualenvs/cv/lib/python3.5/site-packages/cv2.so:
undefined symbol: _ZTIN2cv3dnn19experimental_dnn_v35LayerE
So I decided to just upgrade OpenCV using pip following solution on github https://github.com/CharlesShang/FastMaskRCNN/issues/111:
pip3 install --upgrade opencv-python
It works fine, cv2 successfully imported. But it directly upgraded to opencv 4.0.0 . Is there any way to upgrade opencv to specific version (ex: 3.4.0) using pip?
All you have to do is to put the version in the command as follows
pip3 install --upgrade opencv-python==3.4.0
Actually (in 2020) Opencv library is version 4.2.XX
so my suggestion:
pip3 install --upgrade opencv-python==4.2.34
I am getting the following error when using import cv2:
ModuleNotFoundError: No module named 'cv2'
My version of Python is 3.6 64 bit. I have downloaded the whl file to install it via pip manually, and have also installed it with pip install opencv-python however I still get ModuleNotFoundError.
pip outputs Requirement already satisfied: opencv-python in c:\...\python36\site-packages
Help would be much appreciated.
Your download must have been corrupted. It happened to me too. Simply uninstall the package and use
sudo apt-get install python open-cv
Use pip install -U opencv-python
I use windows 10 64-bit, python 3.6, pip 8.1.2 and kivy 1.9.1. kivywas installed according to the documentation.
After installing kivy I can't import it as I get this error
ImportError: No module named 'kivy'
How can I solve this I searched many times and followed the steps and it ends up with the same problem
Ensure you have the latest pip and wheel:
python -m pip install --upgrade pip wheel setuptools
Install the dependencies (skip gstreamer (~120MB) if not needed, see Kivy’s dependencies):
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
python -m pip install kivy.deps.gstreamer
Note
If you encounter a MemoryError while installing, add after pip install an option
–no-cache-dir
.
For Python 3.5+, you can also use the angle backend instead of glew. This can be installed with:
python -m pip install kivy.deps.angle
Install kivy:
python -m pip install kivy
(Optionally) Install the kivy examples:
python -m pip install kivy_examples
The examples are installed in the share directory under the root directory where python is installed.
This is old, but if anyone stumbles on it the answer can be found here:
trying to install kivy on my pc i get the following errors
All the convenience of wheels can be found with 3.6 now as well as with older versions