Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to resolve dependencies for the Python OCR Library pypdfocr [duplicate]

I have tried installing pypdfocr using the commands:

pip install pypdfocr
pip install -i https://pypi.anaconda.org/pypi/simple pypdfocr

but I am continuously getting the error message:

File "C:\Users\888537\AppData\Local\Temp\pip-build-b4mwr93n\evernote\setup
.py", line 6
        exec x
             ^
    SyntaxError: Missing parentheses in call to 'exec'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\888537\A
ppData\Local\Temp\pip-build-b4mwr93n\evernote\

The following is the log of installation:

    [Anaconda3] C:\Users\888537>pip install -i https://pypi.anaconda.org/pypi/simple
 pypdfocr
Collecting pypdfocr
  Downloading https://pypi.anaconda.org/pypi/simple/pypdfocr/0.7.6/pypdfocr-0.7.
6.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pillow>=2.2 in d:\anac
onda3\lib\site-packages (from pypdfocr)
Requirement already satisfied (use --upgrade to upgrade): reportlab>=2.7 in d:\a
naconda3\lib\site-packages (from pypdfocr)
Collecting watchdog>=0.6.0 (from pypdfocr)
  Downloading https://pypi.anaconda.org/pypi/simple/watchdog/0.8.1/watchdog-0.8.
1.tar.gz (154kB)
    100% |################################| 163kB 52kB/s
Requirement already satisfied (use --upgrade to upgrade): pypdf2>=1.23 in d:\ana
conda3\lib\site-packages (from pypdfocr)
Collecting evernote (from pypdfocr)
  Downloading https://pypi.anaconda.org/pypi/simple/evernote/1.25.0/evernote-1.2
5.0.tar.gz (140kB)
    100% |################################| 143kB 187kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\888537\AppData\Local\Temp\pip-build-b4mwr93n\evernote\setup
.py", line 6
        exec x
             ^
    SyntaxError: Missing parentheses in call to 'exec'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\888537\A
ppData\Local\Temp\pip-build-b4mwr93n\evernote\

How can I rectify this installation problem with pypdfocr library?

like image 352
Anindita Bhowmik Avatar asked Jun 14 '16 13:06

Anindita Bhowmik


1 Answers

Use Python 2.x instead of 3.x or find the line where syntax error occurs and add the parenthesis.

See, in Python 3 exec is a function, but in Python 2 exec is a command.

So in Python 3, you have to put arguments into parenthesis to make a call to exec() properly.

So, you're trying to install the package to Python3 that is meant for Python 2.

At least installation script is.

OK, that is what I can deduce from that error log. I am not familiar with PyPDFOCR, although I Suspect it uses tesseract for OCRing, and probably PDFMiner to access images from a PDF document.

To continue using PIP, first download, not install, the package, then change setup.py, then do python setup.py install.

Although, if a script is for Python 2, it may be that the package in question is meant only for Python 2. Because pip should automatically choose the correct package version for installed Python.

All the mess may have something to do with the Anaconda distro.

Good luck.

like image 120
Dalen Avatar answered Nov 09 '22 07:11

Dalen