Search code examples
pythonocr

How to install pypdfocr?


While trying to install pypdfocr package in python am getting below error.

ERROR: Command errored out with exit status 1:
     command: 'c:\users\User\appdata\local\programs\python\python37-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\GIBIN_~1\\AppData\\Local\\Temp\\pip-install-uansf_7f\\evernote\\setup.py'"'"'; __file__='"'"'C:\\U
sers\\GIBIN_~1\\AppData\\Local\\Temp\\pip-install-uansf_7f\\evernote\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base
 pip-egg-info
         cwd: C:\Users\GIBIN_~1\AppData\Local\Temp\pip-install-uansf_7f\evernote\
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\GIBIN_~1\AppData\Local\Temp\pip-install-uansf_7f\evernote\setup.py", line 6
        exec x
             ^
    SyntaxError: Missing parentheses in call to 'exec'

    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Solution

  • Even though the PyPDFOCR project on pypi is not set up with any version restrictions, it lists evernote as a requirement. If you look at your error message, you will notice that it is actually this installation that is causing issues. This is not suprising, as looking at the github page for evernote reveals:

    Evernote API version 1.28

    This SDK is intended for use with Python 2.X

    For Evernote's beta Python 3 SDK see https://github.com/evernote/evernote-sdk-python3

    So the requirement evernote cannot be installed for your python version (3.7), but you could try it using the python3 version, which is called evernote3 on pypi. To do this, I recommend the following steps:

    1. Download pypdfocr-0.9.1.tar.gz from pypi
    2. Extract the tar.gz and manually change evernote to evernote3 in the requirements.txt
    3. Run python setup.py install

    This should download and install evernote3 as a requirement and then continue with the installation of PyPDFOCR.

    This might fail however if the evernote3 API is different than the evernote API or if other parts of PyPDFOCR depent on python2 in which case you will have to do more manula tweaking or use a virtual environment with python2

    Of course you could also search for another library that is more up to date and serves your needs.