Camelot: DeprecationError: PdfFileReader is deprecated

Question:

I have been using camelot for our project, but since 2 days I got following errorMessage. When trying to run following code snippet:

import camelot
tables = camelot.read_pdf('C:\Users\user\Downloads\foo.pdf', pages='1')

I get this error:

DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.

I checked this file and it does use pdfFileReader: c:ProgramDataAnaconda3libsite-packagescamelothandlers.py

I thought that I can specify the version of PyPDF2, but it will be installed automatically(because the library is used by camelot) when I install camelot. Do you think there is any solution to specify the version of PyPDF2 manually?

Asked By: Said Akyuz

||

Answers:

This is issues #339.

While there will hopefully be soon a release including the fix, you can still do this:

pip install 'PyPDF2<3.0'

after you’ve installed camelot.

See https://github.com/camelot-dev/camelot/issues/339#issuecomment-1367331630 for details and screenshots.

Answered By: Martin Thoma

I solved the issue uninstalling camelot-py and re installing it includeing the "extra cv requirement", like this:

pip install "camelot-py[base]"

I hope it can be useful!

source: https://readthedocs.org/projects/camelot-py/downloads/pdf/master/

Answered By: pierofoust
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.