0

After upgrading Debian, I can't use pip anymore (would like to use it to install pipenv and thus properly manage my virtualenvs…).

I installed pip3 with this command:

apt-get install python3-pip

Here is how pip3 complains:

$ pip3

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 78, in <module>
    raise RuntimeError("Python 3.3 or later is required")
RuntimeError: Python 3.3 or later is required

This is lead by this check in /usr/lib/python3/dist-packages/pkg_resources/__init__.py:

if (3, 0) < sys.version_info < (3, 3):
    raise RuntimeError("Python 3.3 or later is required")

But:

$ python3 --version

Python 3.5.3

And:

$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=5, micro=3, releaselevel='final', serial=0)
>>>

It seems like pip3 is confusing between Python 2 and Python 3 both installed on my debian server.

Have you ever faced this issue?

user650108
  • 1,009
  • 1
  • 9
  • 18
  • 1
    »» apt-get install python3-pip «« : That's `/usr/bin/pip3` https://packages.debian.org/stretch/all/python3-pip/filelist ... and you also have another version `/usr/local/bin/pip3`. Maybe from your previous Debian version. ... ( I would delete all alien python files in /usr/local/ ) – Knud Larsen Jun 03 '18 at 17:19
  • Yes Knud: `which pip3` -> `/usr/local/bin/pip3`... Thank you very much! – user650108 Jun 03 '18 at 17:25
  • `python3 -m pip install -U --force-reinstall pip` did the trick. – user650108 Jun 03 '18 at 17:25

2 Answers2

1

Just do a python3 -m pip install -U --force-reinstall pip.

Thank you Knud Larsen!

user650108
  • 1,009
  • 1
  • 9
  • 18
0

apt-get install python3-pip :

That's /usr/bin/pip3 https://packages.debian.org/stretch/all/python3-pip/filelist

... and you also have another version /usr/local/bin/pip3. Maybe from your previous Debian version.

Knud Larsen
  • 5,753
  • 2
  • 14
  • 19