'ModuleNotFoundError: No module named 'pytesseract' - QGIS Python plugin on Windows 11
As per the title, I am getting an error when executing the PW_OCR_ADVANCED Python script in QGIS on Windows 11. I am writing another question despite similar ones because I couldn't find a solution.
I have installed QGIS, Python, Tesseract, and Pillow and pytesseract packages. When installing pytesseract, I got
WARNING: The script pytesseract.exe is installed in 'C:\Users\*USERNAME*\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
So I have added this PATH in the QGIS custom environment variables (Settings>Options>System).
I have also added the Tesseract executable path to the pytesseract.py script itself as instructed in the script page.
pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
No matter what, this is what I get:
Traceback (most recent call last):
File "C:\OSGeo4W\apps\Python39\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "<string>", line 32, in <module>
File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'pytesseract'
Any clues?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
