相关文章推荐
腼腆的柠檬  ·  python ...·  4 天前    · 
有情有义的大白菜  ·  python ...·  4 天前    · 
完美的馒头  ·  python QTreeWidget ...·  昨天    · 
慷慨的青蛙  ·  Ubuntu 20.04 ...·  4 月前    · 
读研的橡皮擦  ·  python dictdiffer ...·  11 月前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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?

In the requirements of camelot is specified that it needs PyPDF2>=1.26.0. So as long as you install a version that satisfies that requirement, everything should be fine. An issue regarding this problem already exists on their GitHub. – Clasherkasten Dec 28, 2022 at 11:49

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.

I tried pip install PyPDF2<3.0 in Colab but still received the error DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead – Christine Tan Jan 12 at 18:08 @ChristineTan I had this same issue. Double check your PyPDF2 version (pip3 show PyPDF2), and if less than 3.0, restart your kernel/venv and rerun your code. – Celi Manu Feb 2 at 18:40
DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.

Just removing the file from pdfFileReader worked for me. This means writing this PdfReader instead of pdfFileReader this.

I just changed the imports as the error msg suggested:

# From
from PyPDF2 import PdfFileMerger
from PyPDF2 import PdfFileReader
from PyPDF2 import PdfMerger
from PyPDF2 import PdfReader

In my case (version PyPDF2 3.0.0) both classes exists. And I thought that I need to change the code or something, but no, simply worked.

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/

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.