1

I recently set up arch on my machine; installed python. /usr/bin/python was symlinked to /usr/bin/python3 which itself is a symlink to /usr/bin/python3.4.
Because, I use python2.7, I went ahead and linked python to python2.7.
Now when I try to python dependent program, I get the following error.

Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3084, in <module>
@_call_aside
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3070, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3097, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 651, in _build_master
ws.require(__requires__)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 952, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 839, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==7.1.2' distribution was not found and is required by the application

I wish to know what's gone wrong.

Bibek_G
  • 199
  • 1
  • 2
  • 12
  • You should have read http://stackoverflow.com/questions/7297094/proper-way-to-manage-multiple-versions-of-python-on-archlinux – user1514631 Sep 25 '15 at 11:09
  • Thanks for the link. I wanted to understand the error itself, more than how to avoid it. – Bibek_G Sep 25 '15 at 11:38

1 Answers1

2

The pip script in /usr/bin is tied to Python 3.4. The small script is just a bootstrapping script to load the actual code from a module. That module is missing in Python 2.7 because you did not install pip for it.

Either fix the script to replace /usr/bin/python in the first line with /usr/bin/python3, or install pip for Python 2.7.

Alternatively, only link /usr/bin/python2 to Python 2.7 and leave /usr/bin/python to point to Python 3. It is quite likely other Arch programs rely on that being Python 3, anyway. Also see "Proper way" to manage multiple versions of Python on archlinux.

Community
  • 1
  • 1
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Yes other scripts rely on /usr/bin/python being python 3 on archlinux – user1514631 Sep 25 '15 at 11:10
  • so, I guess when I ran `pacman -S python-pip`, pacman installed pip for the right version of python that was default on my system(python3.4)? And if I wanted python2.7 to be the only version of python installed, I would uninstall python3.4 and reinstall every single package that depended on it? – Bibek_G Sep 25 '15 at 11:36
  • @coder_Bibek: Yes, packages installed for Python 3.4 won't work on Python 2.7 without at least a re-install. – Martijn Pieters Sep 25 '15 at 11:38