1

I cannot use pip2 on my raspberry pi. I have Raspbian installed. More information of the version of raspbian I run:

soldy@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye

and my python version(s)

soldy@raspberrypi:~ $ python --version
Python 2.7.18
soldy@raspberrypi:~ $ python3 --version
Python 3.9.2

My current pip version:

soldy@raspberrypi:~ $ pip --version
pip 22.2.2 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9)
soldy@raspberrypi:~ $ pip3 --version
pip 22.2.2 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9)

However I do not have pip2:

soldy@raspberrypi:~ $ pip2 --version
bash: pip2: command not found

What I tried to install pip2:

soldy@raspberrypi:~ $ sudo apt install python2-pip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python2-pip

Then I tried:

sudo apt-get install software-properties-common

which finished without errors. And then I run:

soldy@raspberrypi:~ $ sudo apt-add-repository universe
Traceback (most recent call last):
  File "/usr/bin/apt-add-repository", line 95, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)    
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 91, in get_sources
    raise NoDistroTemplateException(
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/bullseye

And then:

soldy@raspberrypi:~ $ sudo apt-get install python2-pip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python2-pip
3
  • 1
    Python 2.x and hence Pip2 are no longer supported. Aug 18, 2022 at 13:23
  • Good to know! (But I want to install them anyway. Is there a way?) Aug 18, 2022 at 13:27
  • My question got closed 7 months ago but still got 1k views. Oh the irony, I guess mods have to give it a second thought? Apr 7, 2023 at 8:43

1 Answer 1

2

I managed to solve it. From the motioneye's installation instructions:

note 3: pip2 is no longer installed from your distro's repositories. The latest version can be installed using the following instructions:

  curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
  python2 get-pip.py

Where I used sudo to run the commands, so It will be:

 sudo curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
 sudo python2 get-pip.py

so when using pip now, it will use pip2 and not pip3.

Not the answer you're looking for? Browse other questions tagged or ask your own question.