0

I want to upgrade the pytesseract package and I have used this line pip install pytesseract==0.3.7 and I got this as successful

Collecting pytesseract==0.3.7
  Using cached pytesseract-0.3.7.tar.gz (13 kB)
Requirement already satisfied: Pillow in c:\users\future\appdata\local\programs\python\python39\lib\site-packages (from pytesseract==0.3.7) (8.0.1)
Using legacy 'setup.py install' for pytesseract, since package 'wheel' is not installed.
Installing collected packages: pytesseract
  Attempting uninstall: pytesseract
    Found existing installation: pytesseract 0.3.6
    Uninstalling pytesseract-0.3.6:
      Successfully uninstalled pytesseract-0.3.6
    Running setup.py install for pytesseract ... done
Successfully installed pytesseract-0.3.7

When trying the following lines in the cmd

python

then typed import pytesseract, I got the following error messages

Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytesseract
 ** On entry to DGEBAL parameter number  3 had an illegal value
 ** On entry to DGEHRD  parameter number  2 had an illegal value
 ** On entry to DORGHR DORGQR parameter number  2 had an illegal value
 ** On entry to DHSEQR parameter number  4 had an illegal value
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Future\AppData\Local\Programs\Python\Python39\lib\site-packages\pytesseract\__init__.py", line 2, in <module>
    from .pytesseract import ALTONotSupported
  File "C:\Users\Future\AppData\Local\Programs\Python\Python39\lib\site-packages\pytesseract\pytesseract.py", line 36, in <module>
    from numpy import ndarray
  File "C:\Users\Future\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py", line 305, in <module>
    _win_os_check()
  File "C:\Users\Future\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py", line 302, in _win_os_check
    raise RuntimeError(msg.format(__file__)) from None
RuntimeError: The current Numpy installation ('C:\\Users\\Future\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: 

Any ideas of how to fix such a problem?

YasserKhalil
  • 9,138
  • 7
  • 36
  • 95
  • The same problem occurs when importing [numpy-1.19.4](https://github.com/numpy/numpy/issues/17726) " I guess `python -m pip install numpy==1.19.3` might solve your problem. I'm not sure since I'm not using windows, therefore I can't reproduce the problem. – Ahmet Feb 10 '21 at 22:31
  • I already did this line `pip install numpy==1.19.3` and now I can import pytesseract and that's fine. But when trying to check the version of pytesseract by this line `print(pytesseract.get_tesseract_version())`, I got `4.0.0-alpha.20180109` while I installed the version 0.3.7 – YasserKhalil Feb 10 '21 at 22:33
  • Most probably you installed the latest version in different environment. Maybe reinstalling pytesseract on the current environment might solve the problem. – Ahmet Feb 10 '21 at 22:38
  • I think the problem is becuase I installed Tesseract-OCR alpha. Can you provide me with a link of Tesseract-OCR that I should correctly install? Is that link OK https://github.com/tesseract-ocr/tesseract/releases?? But this seems not to be compatabile with Windows OS!! – YasserKhalil Feb 10 '21 at 22:58
  • I think this link https://github.com/UB-Mannheim/tesseract/wiki is related to Windows and I have read the following note as for Windows users `We don't provide an installer for Tesseract 4.1.0 because we think that the latest version 5.0.0-alpha is better for most Windows users in many aspects (functionality, speed, stability). Version 4.1 is only needed for people who develop software based on the Tesseract API and who need 100 % API compatibility with version 4.0.` – YasserKhalil Feb 10 '21 at 23:08

1 Answers1

1

I was able to pip install the 0.3.6 version, upgrade to the 0.3.7 version, and then import and use the package no problem in a similar environment using python 3.9.0.

I would suggest making a virtual environment: python -m venv <path-to-directory>

And then run: <path-to-directory>/Scripts/Activate

Once you do that, try to pip install the package again. If it works, there is something messed up in the python installation at "C:\Users\Future\AppData\Local\Programs\Python\Python39".

I would suggest always installing packages in a virtual environment this way. It will save you a lot of headaches if you are changing configurations or trying new packages often. If it stops working, just make a new environment!

Link: 3.9.1 - venv Docs

mole1000
  • 161
  • 6
  • I have created a new environment. What are the steps of installing the packages..? Will I install numpy 1.19.3 and the wheel then pytesseract will be directly or using `pip install pytesseract==0.3.7`? – YasserKhalil Feb 10 '21 at 22:48
  • 1
    You should just be able to `pip install pytesseract==0.3.7`. Pip should grab any required dependencies. – mole1000 Feb 10 '21 at 22:55