Forums

Cannot import PyPDF2 modules

Offline my code works fine, on pythonanywhere, I get the following error:

from PyPDF2 import PdfReader, PdfWriter, PdfMerger
ImportError: cannot import name 'PdfReader' from 'PyPDF2' (/usr/local/lib/python3.10/site-packages/PyPDF2/__init__.py)

PyPDF2 version on pythonanywhere: 1.27.12

What version are you using locally? If it's a more recent one, than perhaps you just need to upgrade the package installed for your own account -- see this help page.