Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camelot: DeprecationError: PdfFileReader is deprecated

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:\ProgramData\Anaconda3\lib\site-packages\camelot\handlers.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?

like image 401
Said Akyuz Avatar asked Sep 03 '25 03:09

Said Akyuz


1 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.

like image 57
Martin Thoma Avatar answered Sep 05 '25 01:09

Martin Thoma