pytesseract: ModuleNotFoundError: No module named 'PIL'
I am trying to get pytesseract to run on a Windows 10 system but unfortunately always get the following error log:
File "C:\Users\Marc\PycharmProjects\test\venv\lib\site-packages\pytesseract\pytesseract.py", line 27, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Marc\PycharmProjects\test\main.py", line 15, in <module>
import pytesseract
File "C:\Users\Marc\PycharmProjects\test\venv\lib\site-packages\pytesseract\__init__.py", line 2, in <module>
from .pytesseract import ALTONotSupported
File "C:\Users\Marc\PycharmProjects\test\venv\lib\site-packages\pytesseract\pytesseract.py", line 29, in <module>
import Image
ModuleNotFoundError: No module named 'Image'
Process finished with exit code 1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16
Commits related to this issue
- Bump version to 0.3.9 Resoleves #316 — committed to madmaze/pytesseract by int3l 2 years ago
Updating either pip or setuptools solves the problem. Versions that don’t work: pip 20.0.2, setuptools 45.2.0. Versions that do: pip 21.3.1, setuptools 60.5.0.
hi, it’s ok with version 0.3.7, but 0.3.8 crash with same error
from .pytesseract import ALTONotSupported File "/tmp/pip-install-wt3k8kh5/pytesseract/pytesseract/pytesseract.py", line 28, in <module> import Image ModuleNotFoundError: No module named 'Image'
Yeah … It seems that Pillow depends on newer versions of those tools, for reference they even include the update step in the Pillow - Installation docs
Now I have to find which is the minimum version of those tools that allow proper installation and include them to the setup requirements …
While this issue is closed, I’ve observed something interesting – but I don’t know where the breakdown is. I’m installing pytesseract (no version specified) as in a requirements.txt
Adding Pillow prior to pytesseract in the requirements.txt appears to do something, but I still get the issue as above. However, if, and only if, I explicitly run
pip install Pillow
(with or without it being in the requirements.txt) do I get pytesseract to install.