pyscreenshot module not working on run, PIL module not existing [duplicate] - python

This question already has answers here:
ImportError: No module named PIL
(30 answers)
Closed 10 months ago.
I've imported the pyscreenshot module, but when I run code with it, it gives me this error:
Traceback (most recent call last):
File "myfilepaththatiwontshow", line 7, in <module>
import pyscreenshot
File "C:\Users\A\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreenshot\__init__.py", line 4, in <module>
from pyscreenshot.childproc import childprocess_backend_version
File "C:\Users\A\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreenshot\childproc.py", line 6, in <module>
from pyscreenshot.imcodec import codec
File "C:\Users\A\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreenshot\imcodec.py", line 3, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
I've checked twice and the pyscreenshot module is installed and tried running
pip install PIL
but apparently it doesn't exist.

According to its docs, Pillow:
Pillow is the friendly PIL fork by Alex Clark and Contributors
This library is a drop-in replacement for PIL, which is no longer available or supported. To install pillow, use:
pip uninstall PIL
pip install pillow

Related

After installed asprise_ocr_sdk_python_api on mac, got "No module named 'ocr'"

I ran both
sudo pip install asprise_ocr_sdk_python_api
pip install asprise_ocr_sdk_python_api
Got message
"Requirement already satisfied: asprise_ocr_sdk_python_api in /Users/myid/miniconda3/envs/competition/lib/python3.5/site-packages"
But when I ran asprise_ocr to test:
Got the following error:
Traceback (most recent call last):
File "/Users/myuser/miniconda3/envs/competition/bin/asprise_ocr", line 7, in <module>
from asprise_ocr_api.ocr_app import run_ocr_app
File "/Users/myuser/miniconda3/envs/competition/lib/python3.5/site-packages/asprise_ocr_api/__init__.py", line 1, in <module>
from ocr import *
ImportError: No module named 'ocr'
The asprise_ocr_api module doesn't do submodule imports correctly in Python 3.
For example init.py contains from ocr import *. For a sub-module in Python 3 that should be from .ocr import *. Idem for from ocr_app import OcrApp, run_ocr_app. That should be from .ocr_app import OcrApp, run_ocr_app.
After making these changes in all files it imports correctly.
i've tried:
import ocr
same error:
ModuleNotFoundError: No module named 'ocr'
i am using python 3

Windows: ImportError: No module named Image

I'm trying to create a function which reads pptx files. The only module I found is python-pptx. But unfortunately, it raises errors.
There were some problems with installing Pillow when I did: pip install python-pptx so I installed it easy_install Pillow which seems to be working. Then I installed python-pptx. The problem is that when I execute the function it still raises error:
Traceback (most recent call last):
File "C:/Users/Milano/Desktop/Projekty/FS Dropbox/Dropbox/word_counter.py", line 38, in <module>
print get_pptx_word_count('pptx.pptx')
File "C:/Users/Milano/Desktop/Projekty/FS Dropbox/Dropbox/word_counter.py", line 15, in get_pptx_word_count
from pptx import Presentation
File "C:\Users\Milano\Desktop\Projekty\venvs\sfl_venv\lib\site-packages\pptx\__init__.py", line 15, in <module>
from pptx.api import Presentation # noqa
File "C:\Users\Milano\Desktop\Projekty\venvs\sfl_venv\lib\site-packages\pptx\api.py", line 17, in <module>
from .package import Package
File "C:\Users\Milano\Desktop\Projekty\venvs\sfl_venv\lib\site-packages\pptx\package.py", line 16, in <module>
from .parts.image import Image, ImagePart
File "C:\Users\Milano\Desktop\Projekty\venvs\sfl_venv\lib\site-packages\pptx\parts\image.py", line 13, in <module>
import Image as PIL_Image
ImportError: No module named Image
What should I do? I'm on virtualenv. Tried to uninstall Pillow and install PIL but it didn't find anything.
pillow moves all the PIL modules to the PIL package. You will need to modify the import to PIL.Image.

Failture installing PyGreSQL with pip [duplicate]

This question already has answers here:
Python 3: ImportError "No Module named Setuptools"
(22 answers)
Closed 7 years ago.
I am currently trying to install PyGreSQL using pip install PyGreSQL, however, when I run the command I get the following error:
Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 375, in setup_py
import setuptools # noqa
File "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extern.six.moves import filterfalse, map
File "/usr/local/lib/python2.7/site-packages/setuptools/setuptools/__init__.py", line 12, in <module>
from setuptools.extension import Extension
File "/usr/local/lib/python2.7/site-packages/setuptools/extension.py", line 8, in <module>
from setuptools.extern.six.moves import map
ImportError: No module named extern.six.moves
Does anyone know what might be wrong? From what i can tell, something is wrong with extern.six.moves, however, I couldn't find anything about this online...
This ended up being due to the setuptools not being correctly installed on my machine. Thanks #Famarri for helping me realize that

Package (Python PIL/Pillow) installed but I can't import it

I want to do some image processing and I encountered a problem. Importing the pillow module doesn't seem to work. I found a simple script here to check what packages are installed and I found it, but importing it doesn't seem to work.
Here's the code I'm trying to run:
import pip
installed_packages = pip.get_installed_distributions()
installed_pillow_packages = [
"%s==%s" % (i.key, i.version)
for i in installed_packages
if "pil" in i.key.lower()
]
print(installed_pillow_packages)
import pillow
And here's the result:
runfile('C:/Users/Augustas/.spyder2/temp.py', wdir=r'C:/Users/Augustas/.spyder2')
['pillow==2.6.1']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 601, in runfile
execfile(filename, namespace)
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 66, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/Augustas/.spyder2/temp.py", line 7, in <module>
import pillow
ImportError: No module named pillow
I'm running this on Windows 8.1 using Spyder and Python 2.7.9.
You are importing incorrectly. Try using:
import PIL
or
from PIL import Image
PIL, i.e., Python Imaging Library is no longer maintained, Pillow is used instead. To maintain backwards compatibility, the PIL module name is used in imports.
In fact, Pillow is installed under name "PIL", so:
import PIL as pillow
from PIL import Image
...
Look this:
Checkout the doc:
http://pillow.readthedocs.org/handbook/tutorial.html
You must import it like that:
import PIL

Error No module named six

I am new to Python/OpenCV.
I have the code below run in Python. But I got an error as shown below.
>>> from matplotlib import pyplot as plt
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
from matplotlib import pyplot as plt
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
import six
ImportError: No module named six
I followed what is being suggested in this post: ImportError: No module named six
I have downloaded six-1.8.0.tar.gz and unzip the file. I am wondering of is the next thing to do? I tried to run the six.py but I still got the same error.
You shouldn't need to download the tar.gz file. Instead run this at the command line (note, not the Python command line):
pip install six
And if that doesn't work, try:
easy_install six
I met the same problem (No module named six) when I tried to import nltk and to type easy_install six in cmd (Windows), it installed six for me.
And I imported nltk successfully.

Categories

Resources