Ask coding questions

← Back to all posts
Does support pytesseract???
TheLostProgramm (1)

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/", line 255, in run_tesseract
    proc = subprocess.Popen(cmd_args, **subprocess_args())
  File "/usr/lib/python3.8/", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/", 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/", line 343, in _run_event
    await coro(*args, **kwargs)
  File "", line 664, in on_message
    text = pytesseract.image_to_string(demo, lang="eng")
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pytesseract/", line 409, in image_to_string
    return {
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pytesseract/", line 412, in <lambda>
    Output.STRING: lambda: run_and_get_output(*args),
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pytesseract/", line 287, in run_and_get_output
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pytesseract/", 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?

19ecal (228)

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

TheLostProgramm (1)

I get this as the output:

bash: sudo: command not found
19ecal (228)

@TheLostProgramm PyTesseract is probably not supported on replit then

OldWizard209 (1089)

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

TheLostProgramm (1)

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.

OldWizard209 (1089)

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