1

I am trying to install pip onto my windows laptop by running command python get-pip.py but I am getting the following error: c:\appdata\temp\tmplplp3q\pip.zip\pip\_vendor\urllib3\util\ssl_.py:339: 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.io/en/latest/advanced-usage.html#ssl-warnings

My python version is 2.7.9. Any help would be greatly appreciated! Thanks

The suggested duplicate is different to my question as I can't install pip to begin with and the error is given way before I can try to download any package.

Haris
  • 55
  • 1
  • 2
  • 8
  • You downloaded *get-pip.py* from https://bootstrap.pypa.io/get-pip.py? Try getting the one for 2.6: https://bootstrap.pypa.io/2.6/get-pip.py. – CristiFati Apr 27 '18 at 13:30
  • Yep that's correct. I just tried the 2.6 one but still gave the same SSL error unfortunately. – Haris Apr 27 '18 at 13:37
  • What *OpenSSL* version was *Python2.6* built with? You can find out by typing in the console `import ssl`, `ssl.OPENSSL_VERSION`. You might not like what you're going to find :) – CristiFati Apr 27 '18 at 13:46
  • Possible duplicate of [pip install fails for every package ("Could not find a version that satisfies the requirement")](https://stackoverflow.com/questions/49748063/pip-install-fails-for-every-package-could-not-find-a-version-that-satisfies-th) – phd Apr 27 '18 at 14:03
  • @phd it's not a dup. The error happens before the indicated question. – CristiFati Apr 27 '18 at 14:05
  • So as I am on Python2.7 the version outputted was: `OpenSSL 0.9.8l 5 Nov 2009` – Haris Apr 27 '18 at 14:06
  • This OpenSSL is too old. You have to upgrade Python with OpenSSL at least 1.0.1. – phd Apr 27 '18 at 14:07
  • The thing is I can't upgrade Python as the framework at work is based on Python 2 and I won't be able to upgrade. Is there a way where I can just upgrade OpenSSL on it's own? Thanks for pointing out the issue though! – Haris Apr 27 '18 at 14:10
  • No, *OpenSSL* is built into the extension module. Can't you at least upgrade it to *2.7.\**? Or, there's always the possibility of doing things from scratch: building your own *OpenSSL* and your own *Python* :d. – CristiFati Apr 27 '18 at 15:55
  • Oh right, I will give upgrading the Python a try and see if that sorts it out. Ahaha I don't know if i will be able to do that! Going to need a lot of ropes to climb that one :p – Haris Apr 27 '18 at 16:57

1 Answers1

-1

Have you already tried to install urllib3 with the secure extra? Try this way:

pip install urllib3[secure]

Alternatively, if it's not mandatory to use that old version, I would suggest to upgrade Python to the latest version, since your problem may be caused by the lack of SNI support on that ssl module. EDIT: I am clearly assuming that you have pip regularly installed, since you said you're using Python v2.7.9 and then PIP comes installed with Python by default. Try to see if it's allright with pip:

python -m pip --version
  • Thanks for the reply! I don't have pip installed so I can't really use the commands you mentioned or use pip at all. – Haris Apr 27 '18 at 12:35
  • Tried this: [link](https://github.com/pypa/pip/issues/2351) but after running `python pip-6.0.6-py2.py3-none-any.whl/pip install --no-index pip-6.0.6-py2.py3-none-any.whl` an error is thrown: `ERROR: To modify pip, please run the following command:` – Haris Apr 27 '18 at 13:29
  • Can I ask you how and when have you installed Python? I also need the output of `python -m pip --version`, just to be sure that we are on the same page of the book. – HalfBloodPrince Apr 27 '18 at 13:45
  • It says no module named pip when I run that command, and i downloaded Python 2.7.amd64 from [link](https://www.python.org/downloads/windows/) in March – Haris Apr 27 '18 at 14:08
  • Uhm, that is weird, because pip comes preinstalled with that version of python. Ok ok, let's try to force the installation of the bundled pip: `python -m ensurepip -Uv` – HalfBloodPrince Apr 27 '18 at 14:18
  • Nope I don't think with 2.7 you have to get it by get-pip.py. Sure will give it a try. Says no module named ensurepip. – Haris Apr 27 '18 at 14:19
  • Let me know! :) – HalfBloodPrince Apr 27 '18 at 14:20
  • 1
    That's weird. ensurepip comes embedded with your Python version: https://docs.python.org/2/library/ensurepip.html Always wondering if you have included python to windows PATH variable or if it's a broken installation. – HalfBloodPrince Apr 27 '18 at 15:24