-
-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An error occurred: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead. #444
Comments
I have the same problem, have resolved this?? |
It seems that PyPDF2 (which camelot depends on) has implemented a breaking change on its API. Short term fix is to manually install the last PyPDF2 version that works with the old API (before 3.0.0, as per the error message) after you have installed camelot:
Also, PyPDF2 is changing to PyPDF...this should be taken in account for the future. From their pypi page:
|
python -m pip install "pypdf2<3". Yet error remained. Successfully installed pypdf2-2.12.1 DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead. |
@juliatong , can you check with |
Hi @paluigi, First of all, you are right. Indeed my jupter notebook wasn't picking up the change, despite Successfully installed pypdf2-2.12.1. It seems the kernel still took version 3 from the error msg you as point out. restarted the kernel, and the error msg is gone. Big shout on your attention to details. However, after it, a new error came up. _raise RuntimeError('Ghostscript is not installed') RuntimeError: Please make sure that Ghostscript is installed .While I pip show Ghostscript is indeed there... solution is to run commands below. solution is to run commands below. Here is the thing. The ghostscript package I installed through pip install is a Python interface to the Ghostscript C-API, and it doesn't include the Ghostscript executable itself. The Python package interacts with the Ghostscript library but doesn't install the Ghostscript command-line executable (gs). That's why above lines resolved my problem as they manually install the executable. |
import PyPDF2
Function to extract and display text from a PDF
def extract_and_display_pdf(pdf_file):
try:
# Open the PDF file
pdf_file = open(pdf_file, 'rb')
pdf_file_path = 'sample.pdf'
extract_and_display_pdf(pdf_file_path)
The text was updated successfully, but these errors were encountered: