0

I'm kind of new to python and still learning. I've just installed my first package via pip on windows. And went with pytesseract. Now I'm having a ModuleNotFoundError: No Module Named 'pytesseract'.

I've tried alot of the suggestions I've been able to find, like updating pip and reinstalling the tesseract package, changing the tesseract_cmd path to where the tesseract.exe file is located, and having the path and the Var in the test code I'm working on, restarting the kernal and the pc. But no matter what I do I cant seem to get this to work.

Any suggestions?

enter image description here enter image description here enter image description here

Update ************

I had to install miniconda and install pytesseract in that to get the error to disapear, apparently it got something to do with my choise of IDE (Spyder).

Now it just wont take the image.

enter image description here enter image description here

**** UDATE **** So @MrBlue6 aided me in this and was a great help.

As you might be able to tell I tried getting this to work through both PIP and Miniconda. I dont know if it is a IDE issue, but I was unable to get either way to work on my chosen IDE Spyder. How ever, when I used the path to the windows installer @MrBlue6 supplied me with, and tinkering abit with the code and the path, I got it running and working.

enter image description here enter image description here

Morten Paaske
  • 35
  • 1
  • 1
  • 6
  • Are you using a venv? And do you have multiple python versions installed on your pc? – mrblue6 Mar 01 '23 at 23:01
  • I'm not using venv. As fare as I'm aware, I only have the one Python version. – Morten Paaske Mar 02 '23 at 06:47
  • I finaly got it to accept the module. Had to install miniconda and anaconda promt to install pytesseract. So fare so good. No I just cant read of the damn image. I've put it into a try/except and it runs the tesseract_cmd and print("success") but fails to print from the image and goes into the except and print("fail").. – Morten Paaske Mar 02 '23 at 15:57
  • What is the exception it is throwing? You can get that by changing the line to: ```except Exception as e:``` and then ```print(e)``` – mrblue6 Mar 02 '23 at 16:32
  • @mrblue6 Thanks alot, that actually helps alot.. I get an "tesseract is not installed or it's not in your PATH. See README file for more information.". – Morten Paaske Mar 02 '23 at 19:38
  • No worries. Maybe try the top answer on here? https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i – mrblue6 Mar 02 '23 at 19:40
  • Ah I think I see your problem now. You're giving the wrong path to tesseract_cmd. You need to give it the path of the tesseract.exe file, which you should've installed. The link in my previous comment should help you solve this. – mrblue6 Mar 02 '23 at 19:42
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/252262/discussion-between-mrblue6-and-morten-paaske). – mrblue6 Mar 02 '23 at 19:47
  • I simply dont get it, I can see the "pytesseract.exe" file in the folder that I'm pointing at, so it should be installed and working, I think.. – Morten Paaske Mar 02 '23 at 20:24

1 Answers1

0

It seems you are giving the wrong path. You must give the path of the tesseract.exe file not the tesseract library.

tesseract_cmd = r"C:\Users\name\AppData\Local\Programs\Tesseract-OCR11\tesseract.exe"

The above is the default location. If you have changed the install location, locate the exe file and simply give the path to tesseract_cmd.

mrblue6
  • 587
  • 2
  • 19