Shivendra
Shivendra

Reputation: 1096

Python and Pip not in sync

I am working on a remote linux server with python 2.7.6 pre-installed. I want to upgrade to python 2.7.12 (because I am not able to install some libraries on the 2.7.6 due to some ssl error shown below).

I downloaded and compiled from source and installed 2.7.12 and python2.7 opens 2.7.12. However, I still get an update python version warning while using pip. It seems the pip has not synced with 2.7.12 and continues to serve 2.7.6 and I am not able to find other installations of pip in system.

I just want a working version of python2.7.x with pip/pip2/pip2.7 working properly.

    /usr/local/lib/python2.7/dist-packages/pip-8.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip-8.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

Upvotes: 1

Views: 2532

Answers (2)

Shivendra
Shivendra

Reputation: 1096

Thanks @Evert , just before looking into your solution I tried,

curl -O https://bootstrap.pypa.io/get-pip.py
python27 get-pip.py

This fixed my issue and I was able to install libraries to 2.7.12 using pip/pip2.7

I was earlier trying python2.7 -m pip install package-name and I was getting pip not found.

Upvotes: 0

user707650
user707650

Reputation:

Upgrade (and automatically reinstall) pip this way:

/path/to/python2.7.12 -m pip install pip --upgrade

The -m flag loads the corresponding module, and in the case of pip will execute pip (thanks to the power of the __main__ module inside the package).

After installation, your current pip should also be up-to-date.


Alternatively, you could run

/path/to/python2.7.12 /path/to/pip2 install pip --upgrade

NB: be wary about which pip and python2 you're running: there'll probably be a /usr/bin/python and /usr/bin/pipnext to the ones you installed in/usr/local/. The ones in/usr/bin` should just be updated following the standard system updates, if at all.

Upvotes: 1

Related Questions