Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installing pip using get_pip.py SNIMissingWarning

I am trying to install pip on my Mac Yosemite 10.10.5using get_pip.py file but I am having the following issue

User-MacBook-Pro:Downloads myself$ sudo python get-pip.py 
The directory '/Users/myself/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/myself/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
/tmp/tmpOofplD/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: 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. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
/tmp/tmpOofplD/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [Errno 1] _ssl.c:510: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm - skipping
  Could not find a version that satisfies the requirement pip (from versions: )
No matching distribution found for pip

According to the my error message and urllib3 my problem is because I have a python installation version earlier than earlier than 2.7.9 but my python is 2.7.10 as you can see

User-MacBook-Pro:docs myself$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version_info
sys.version_info(major=2, minor=7, micro=10, releaselevel='final', serial=0)
>>> 

I verified my openssl installed and it seems to be ok

User-MacBook-Pro:docs myself$ brew install openssl
Warning: openssl-1.0.2f already installed

not sure how to fix this, any idea ?

like image 881
Cobry Avatar asked Feb 21 '16 11:02

Cobry


People also ask

How do I manually install pip in Python?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process.

Can you pip install in Python shell?

pip is run from the command line, not the Python interpreter. It is a program that installs modules, so you can use them from Python. Once you have installed the module, then you can open the Python shell and do import selenium . The Python shell is not a command line, it is an interactive interpreter.


3 Answers

need install:

pip install pyopenssl ndg-httpsclient pyasn1 

link: http://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl

By default, we use the standard library’s ssl module. Unfortunately, there are several limitations which are addressed by PyOpenSSL:

(Python 2.x) SNI support. (Python 2.x-3.2) Disabling compression to mitigate CRIME attack.

To use the Python OpenSSL bindings instead, you’ll need to install the required packages:

pip install pyopenssl ndg-httpsclient pyasn1 
like image 61
lbsweek Avatar answered Oct 13 '22 21:10

lbsweek


You have a problem with folder privileges. The folder of

/Users/ME/Library/Caches/pip/http 

or one of its ancestors is not owned by the user with which you intend to interact with them. You need to check which user you are trying to do this and you need to make sure that the given user has the necessary permissions for all the folders in the path.

like image 21
Lajos Arpad Avatar answered Oct 13 '22 21:10

Lajos Arpad


Directory Permission Issue

Lines one and two of the output say that there is an issue with the folder's privileges. You can see if you need to change the permissions by doing ls -a /Users/ME/Library and checking if the permissions are equal to drwx------+. If they aren't you can resolve the problem by using chmod to change the permissions: chmod 700 /Users/ME/Library.

However seeing as the first execution line (User-MacBook-Pro:Downloads ME$) has the ME$ as the prefix you shouldn't have this problem as it indicates . You are also running get_pip.py as root so permissions should not be an obstacle. The problem becomes clearer when you view the second execution line (User-MacBook-Pro:Downloads myself$), it seems that the script is being executed as myself as opposed to ME which would explain why there was the error that there was. I presume that you entered the shell in an abnormal way as it shouldn't change like that. Could you give more details in how you entered the shell and could you rerun the script?

SSL

In the unlikely event that permissions was not the problem this may be it. The fourth-last line seems to suggest that there was a problem regarding the ssl. If you have homebrew installed you can do brew install openssl. Note the lack of sudo as homebrew doesn't play well with it. After that try running the script again. Again it it most likely a permissions error and you should try to resolve that first.

like image 24
Koga Avatar answered Oct 13 '22 22:10

Koga