4

I am trying to install tesseract 4.1.1 in google colab. I have installed tesseract and I can check the version using !tesseract --version. After that I have download eng.traineddata and org.traineddata in the /usr/local/share/tessdata/ folder

Now when trying to use it from python it's giving me the following error

TesseractError: (1, 'Error opening data file /usr/local/share/tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'eng\' Tesseract couldn\'t load any languages!)

I have tried to check the file exist or not using this


if os.path.isfile('/usr/local/share/tessdata/eng.traineddata'):
    print ("File exist")

which prints File exist. Any help regarding that will be appreciated. Thanks

Joy Mazumder
  • 870
  • 1
  • 8
  • 14

1 Answers1

-1

Try this command

export TESSDATA_PREFIX=/usr/local/share/ 
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
  • Remember that Stack Overflow isn't just intended to solve the immediate problem, but also to help future readers find solutions to similar problems, which requires understanding the underlying code. This is especially important for members of our community who are beginners, and not familiar with the syntax. Given that, can you [edit] your answer to include an explanation of what you're doing and why you believe it is the best approach? – Jeremy Caney Dec 12 '21 at 00:59