How to install pypdfocr?

Question:

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

ERROR: Command errored out with exit status 1:
     command: 'c:usersUserappdatalocalprogramspythonpython37-32python.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base
 pip-egg-info
         cwd: C:UsersGIBIN_~1AppDataLocalTemppip-install-uansf_7fevernote
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersGIBIN_~1AppDataLocalTemppip-install-uansf_7fevernotesetup.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.
Asked By: m.gibin

||

Answers:

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.

Answered By: FlyingTeller

Whenever possible, avoid using the python setup.py install command. It is preferable to use the pip install . command instead.

so, after step2 of @FlyingTeller’s answer run pip install .

With python setup.py install approach, you may encounter problems while removing a package. All of the files that were installed this way must be removed manually.

Answered By: Wasim Aftab
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.