I'm trying to use Pillow in my python(tkinter) project. I used pip install Pillow to install the package.
When I type from PIL import ImageTk, Image and try to run my code I get the error ModuleNotFoundError: No module named 'PIL. I tried several things like updating pip, uninstalling Pillow and reinstalling it again, using different commands to install it etc.
I don't know what to do now since I never had this problem before. Does anybody know how to fix this?
Related
I have already installed imutils by using both methods pip install as well as pip3 install. but still, it is showing the same error while importing the module. The error says that "ModuleNotFoundError: No module named 'imutils' "
enter image description here
please help as my project deadline is near.
Try to run:
pip install –upgrade imutils
import pip
pip.main(['install', 'imutils'])
this worked for me in jupyter notebook. this method I found in pythonfixing.com . I dont know what it means. If someone knows what this command means please tell me.
But after executing this command in jupyter notebook, I was able to import the installed imutils in jupyter notebook.
There are chances that you've not installed the module at the correct location. Make sure the path is correct where the module is getting installed. The modules should be installed in the Scripts folder with pip using cmd. Investigate the file path and try again. Your code should work
I am using macOS and installed pillow in the terminal with code pip3 install pillow and I got the version 8.0.1.
But I cannot import it in Pycharm. I typed from PIL import Image and an error message show ModuleNotFoundError: No module named 'PIL' . then I changed PIL to pillow from pillow import Image, it works but cannot find Image class.
How can I fix it?
Is very likely that your Pycharm has created a virtual environment for the project and is not using the same library as the python on the system.
If that is the case, go to Settings > Project > Python Interpreter, press on the plus sign (+), write Pillow on the search bar, select the right package, and add it to your interpreter running on PyCharm.
I recommend the use of the pipenv tool to manage your project dependencies for each project. It helps you to maintain the project dependencies separated from the system or other projects.
Pillow not pillow.
run pip uninstall pillow then run pip install Pillow.
Not sure if the solutions given have worked for everyone but try but writing the imports out separately. I tried everything and by accident this worked. So try as below, I hope this works for anyone who needs the help
from PIL import Image
from PIL import ImageTk
I'm trying to import cryptography for my project, but for some reason when I try to install it, I get No module named 'letters'. Through pip and pip3 it worked without any problem, but when I want to install it from settings in PyCharm, the error pops out.
I have pillow installed and I have followed multiple answers however, when i try to run my program it says "ModuleNotFoundError: No module named 'Pillow'
I have already downloaded pillow through GIT Bash by following instructions from answers on how to and I have already tried replacing the 'pillow' for 'PIL' but i get the same error.
My code:
from Pillow import ImageTk,Image
EDIT: I am using version 3.6.5 of Python
Unfortunately I don't have enough reputation to comment on your post.
First, try these import statements:
import PIL
# OR
from PIL import *
I just want to ask you to make sure that PIL is correctly installed. Run the following python code as a single-line python file. This will print out a list of python modules installed.
help('modules')
See if PIL or Pillow on the list. If not, then PIL is not correctly installed.
I was also just wondering if you can use pip (python's package manager) to re-install Pillow. Since you're using python 3.6.5, pip is pre-installed. If you don't mind using pip, execute the following command in CMD on Windows or Terminal on a Mac to install PIL with pip:
python -m pip install pillow
Try again with your original import statements with PIL and Pillow. If none of these works, try the following import statements, again:
import PIL
# OR
from PIL import *
How this helps.
I am having trouble running a python script file that contains import opencv command. Upon running the file, it gives the following error:
ImportError: No module named cv2
I then ran pip install python-opencv but it gave Could not find a version that satisfies the requirement python-opencv (from versions: )
No matching distribution found for python-opencv error.
Does anyone know what the issue might be? I was able to run this python file at first but I haven't been able to run after that.
Package name is wrong pip install opencv-python Should work.
I also had this issue. Tried different things. But finally
conda install opencv
solved the issue for me.