Skip to content
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

No module named 'PyPDF2' #456

Closed
KugelschreiberY opened this issue Sep 14, 2018 · 10 comments
Closed

No module named 'PyPDF2' #456

KugelschreiberY opened this issue Sep 14, 2018 · 10 comments
Labels
is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF

Comments

@KugelschreiberY
Copy link

Hi there,

I tried to install PyPDF2 via pip using python 3.6 on MacOS with the command:
pip3 install PyPDF2
Unfortunately when trying to import PyPDF2, it get a ModuleNotFoundError.

Through my search, I also stumbled over some dependency to pdfmerge, but installing it just threw another error. Regarding to other people who had the same problem, setuptools has to be updated.
But running
pip3 install --upgrade setuptools
did not help. I hope this is the right place to report/ask for help.
Thanks!

@KugelschreiberY
Copy link
Author

Still cannot get it work with python 3.6, using python 2.7 works like a charm.

@jugmac00
Copy link

jugmac00 commented Dec 10, 2018

On Ubuntu 18.04 with Python 3.6.7 there seems to be no issue.

~/Projects/test_pypdf2$ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyPDF2
>>> dir(PyPDF2)
['PageRange', 'PdfFileMerger', 'PdfFileReader', 'PdfFileWriter', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_version', 'filters', 'generic', 'merger', 'pagerange', 'parse_filename_page_ranges', 'pdf', 'utils']
>>> PyPDF2.PdfFileMerger
<class 'PyPDF2.merger.PdfFileMerger'>
>>>

@KrisLloyd
Copy link

KrisLloyd commented Sep 20, 2019

Not a "proper" fix for your problem, but you can clone the PyPDF2 github repo into your working directory for whichever python script you're working on, then do an import.

Project Directory:

  • yourScript.py
  • PyPDF2

In yourScript.py:
import PyPDF2.pdf
from PyPDF2.pdf import PdfFileReader

If you have things organized like this, it should work perfectly.

@MartinThoma MartinThoma added the is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF label Apr 7, 2022
@MartinThoma
Copy link
Member

Hm, I wonder if it is related to PyPDF2 using distutils?

@MartinThoma
Copy link
Member

Can anybody confirm issues / that it works on Mac?

MartinThoma pushed a commit that referenced this issue Apr 7, 2022
This allows the project to make use of modern Python packaging features such as wheels, isolated builds, and more.

The change is also going to be necessary soon; distutils will soon be deprecated in 3.10, and removed from the standard library in 3.12.

Closes #465
Closes #313

Might fix #581 , #456
@MartinThoma
Copy link
Member

I just installed PyPDF2 on a mac via pip. Works fine.

@Atharva-Weginwar
Copy link

I am getting the same issue on Mac OS. I have tried installing PyPDF2 using pip and pip3 both its showing requirements are satisfied still when i am trying to run the app.py via streamlit, It throws the error " Model not found: PyPDF2"

@pubpub-zz
Copy link
Collaborator

pypdf2 is deprecated, replaced by pypdf.

@Atharva-Weginwar
Copy link

Is there any other pip command to install pypdf as pip install pypdf is not working at my end.

@pubpub-zz
Copy link
Collaborator

pubpub-zz commented Apr 23, 2024

pypdf is available on pypi.org so you should not meet an issue to install it if your python/network configuration is correct. as an alternative you should download manually the whl file from https://pypi.org/project/pypdf/#files and then pass the whl file as argument :
pip install file.whl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF
Projects
None yet
Development

No branches or pull requests

6 participants