Python Forum
Problem with installing PyPDF2 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Problem with installing PyPDF2 (/thread-22368.html)



Problem with installing PyPDF2 - Pavel_47 - Nov-10-2019

Hello,
Here is what happens when I'm trying to install PyPDF2:
Output:
sudo pip3 install PyPDF2 Traceback (most recent call last): File "/usr/bin/pip3", line 9, in <module> from pip import main ImportError: cannot import name 'main'
Any suggestions ?
Thanks.


RE: Problem with installing PyPDF2 - snippsat - Nov-10-2019

(Nov-10-2019, 01:52 PM)Pavel_47 Wrote: File "/usr/bin/pip3", line 9, in <module>
Bug report
Quote:User runs the system wrapper from /usr/bin/pip3 which is from the OS-supplied pip 8.
This wrapper expects to see pip 8, but it doesn't because user site takes priority over system site.
So it can use the old pip-8 that's placed in /usr/bin/pip3,newest version is now pip-19.3.1.
A fix that is in the link.
sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall

Or pyenv Simple Python Version Management then is never sudo or pip3 and it use internal pip version from Python.
Then it work like this.
# Check pip see that it point to Python version not OS
tom@tom:~$ pip -V
pip 19.3.1 from /home/tom/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip (python 3.7)

# Install
tom@tom:~$ pip install PyPDF2
Collecting PyPDF2
  Downloading .....
Installing collected packages: PyPDF2
  Running setup.py install for PyPDF2 ... done
Successfully installed PyPDF2-1.26.0



RE: Problem with installing PyPDF2 - Pavel_47 - Nov-10-2019

Worked. Thanks !