I am trying to install pip on my Linux environment, but it is not installing properly.

Python version - 2.6.6

When I try to install pip using the following command,

python setup.py install

Following is the message which I got.

running install
running bdist_egg
running egg_info
writing src/pip.egg-info/PKG-INFO
writing top-level names to src/pip.egg-info/top_level.txt
writing dependency_links to src/pip.egg-info/dependency_links.txt
writing entry points to src/pip.egg-info/entry_points.txt
reading manifest file 'src/pip.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'docs/docutils.conf'
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/cachecontrol/adapter.py to adapter.pyc
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/pip/_vendor/cachecontrol/adapter.py', 13, 34, '    invalidating_methods = {"PUT", "DELETE"}\n'))

byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/cachecontrol/heuristics.py to heuristics.pyc
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/pip/_vendor/cachecontrol/heuristics.py', 101, 12, '        200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501\n'))

byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/help.py to help.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/exceptions.py to exceptions.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/_internal_utils.py to _internal_utils.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/status_codes.py to status_codes.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/api.py to api.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/sessions.py to sessions.pyc
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/pip/_vendor/requests/sessions.py', 750, 52, '        state = {attr: getattr(self, attr, None) for attr in self.__attrs__}\n'))
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/pip/_vendor/requests/models.py', 655, 51, '        return {attr: getattr(self, attr, None) for attr in self.__attrs__}\n'))

but in the last of the error message,

SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_internal/req/req_uninstall.py', 180, 37, '        os.path.join(folder, "*") for folder in folders\n'))

SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_internal/cli/parser.py', 157, 37, '        section_items = {name: [] for name in override_order}\n'))

SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_internal/cli/cmdoptions.py', 96, 48, "    binary_only = FormatControl(set(), {':all:'})\n"))

pip 19.0.3 is already the active version in easy-install.pth
Installing pip script to /usr/bin
Installing pip2.6 script to /usr/bin
Installing pip2 script to /usr/bin

Installed /usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg
Processing dependencies for pip==19.0.3
Finished processing dependencies for pip==19.0.3

and when I check for pip version, it gave me the following result,

$ pip --version    
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==19.0.3', 'console_scripts', 'pip')()
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 299, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2229, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_internal/__init__.py", line 19, in <module>
    from pip._vendor.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_vendor/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_vendor/urllib3/connectionpool.py", line 92
    _blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK}

Following are the details of Linux system,

$ uname -r

$ cat /etc/system-release-cpe

$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)

You’d probably be better off installing “python-pip” from EPEL than a manual install. From what you’ve done, you might have already rendered the host unable to get any software updates via “yum” because of broken python libraries.

Also, your system is at least 6 years it of date if you are honestly running Oracle Linux 6.3.

  • Thank you. Do I need to uninstall the pip what I have installed ? If yes how ?. Actually I have downloaded pip from website and ran the command: "python install setup.py". I have tried "python uninstall setup.py" and "python remove setup.py" and "pip uninstall". None of them worked, when I am using the last command I got the same error which I posted earlier. – abc May 6 '19 at 3:31
  • This is unfortunately one of the reasons why I suggest people avoid manually installing python modules. Maybe if you remove the .egg directory mentioned in the error it will use the packages library. – jsbillings May 6 '19 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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