Skip to content
Sign upLog in
← Back to Community

Does repl.it support pytesseract???

Profile icon
TheLostProgramm

I am trying to use pytesseract but I get this error:

Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pytesseract/pytesseract.py", line 255, in run_tesseract proc = subprocess.Popen(cmd_args, **subprocess_args()) File "/usr/lib/python3.8/subprocess.py", line 858, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.8/subprocess.py", line 1706, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'tesseract' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "main.py", line 664, in on_message text = pytesseract.image_to_string(demo, lang="eng") File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pytesseract/pytesseract.py", line 409, in image_to_string return { File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pytesseract/pytesseract.py", line 412, in <lambda> Output.STRING: lambda: run_and_get_output(*args), File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pytesseract/pytesseract.py", line 287, in run_and_get_output run_tesseract(**kwargs) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pytesseract/pytesseract.py", line 259, in run_tesseract raise TesseractNotFoundError() pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.

Does anyone know how to fix this?

Voters
Profile icon
TheLostProgramm
Comments
hotnewtop
Profile icon
19ecal

Because tesseract is actually an executable, you need to run these commands in the shell to install it

sudo apt-get update sudo apt-get install tesseract-ocr sudo apt-get install libtesseract-dev

As well as a pip installation
This link is helpful
https://towardsdatascience.com/read-text-from-image-with-one-line-of-python-code-c22ede074cac

Profile icon
TheLostProgramm

@19ecal

Hi,
I get this as the output:

bash: sudo: command not found
Profile icon
19ecal

@TheLostProgramm
Try it without the sudos

Profile icon
TheLostProgramm

@19ecal

It didn't work...

Profile icon
19ecal

@TheLostProgramm
PyTesseract is probably not supported on replit then

Profile icon
OldWizard209

Go to the shell and run this command:
pip install pytesseract
Also here is the official Python pytesseract documentation which will guide you with the installation. Lastly, you can also use the pip install <pacakge_name> to install any pacakge

Profile icon
TheLostProgramm

@OldWizard209

Hi, thanks for the reply. I have tried to use pip and I get this:

pip install pytesseract Requirement already satisfied: pytesseract in /opt/virtualenvs/python3/lib/python3.8/site-packages (0.3.7) Requirement already satisfied: Pillow in /opt/virtualenvs/python3/lib/python3.8/site-packages (from pytesseract) (8.1.2)

But the error still appears.

Profile icon
OldWizard209

try a different repl. Fork this one and run the command again and then run the program.

@TheLostProgramm