Pip install fails: SSL required

2019-02-13 15:26发布

问题:

Collecting rsa==3.1.1 (from -r /racetrack/.requirements.txt (line 41))
eval (python -m virtualfish)
  Downloading rsa-3.1.1.tar.gz
    Complete output from command python setup.py egg_info:
    Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.10.tar.gz
    Traceback (most recent call last):          
      File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 403: SSL is required

回答1:

Solution: Upgrade to the latest version of your library.

It all starts here, suddenly(on Oct-2017) the Distutils team decided to revoke support for non-https requests without worrying about breaking the backward compatibility of earlier versions of numerous python libraries. Bit unprofessional, but hey it's Python world.

So here is the fix, Simply move on to the latest version of the library (rsa==3.4.2 in my case) on whatever library (nltk==3.2.5 etc)

Alternate Solution: Fork(or locally copy) the version of repo & modify the http url into https

Nonetheless, watch out if you are doing this while maintaining another project since the dependency you are upgrading might not be compatible with the original library the author had intended, for example in my context rsa was used under another library as a dependency. Thus the solution was to upgrade the parent library so that this issue is automatically taken care.

PS: To avoid confusion, while building requirements.txt make entries on only the libraries you really use, not their & their dependencies. Pip will automatically resolve them. (DRY)



回答2:

Using easy_install rather than pip worked for me:

easy_install funkload

I was attempting to pip install funkload and was getting:

Collecting funkload
  Using cached funkload-1.17.1.tar.gz
  Complete output from command python setup.py egg_info:
  Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.14.tar.gz
  Traceback (most recent call last):
...<snip>
  urllib2.HTTPError: HTTP Error 403: SSL is required

As funkload dates from 2011, the older easy_install works.



回答3:

Just an easy_install rsa==3.1.1 will do the job.