Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

urllib2.HTTPError: HTTP Error 403: SSL is required when installing nltk==2.0.5

Tags:

pip

nltk

When installing nltk==2.0.5, I get the error urllib2.HTTPError: HTTP Error 403: SSL is required. Really, I'm trying to install newspaper, but it's failing when trying to install this package.

A minimal Dockerfile to reproduce the issue:

FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y python-pip

# problem occurs with or without the following line
RUN pip install --upgrade pip

CMD ["pip", "install", "nltk==2.0.5"]
like image 478
Samuel Taylor Avatar asked Oct 27 '17 14:10

Samuel Taylor


2 Answers

  1. wget https://pypi.python.org/packages/source/d/nltk/nltk-2.0.5.tar.gz
  2. tar -xzf nltk-2.0.5.tar.gz
  3. change DEFAULT_URL from http to https in nltk-2.0.5/distribute_setup.py
  4. pip install that directory, or if you trust I did the above then do: pip install https://s3-us-west-2.amazonaws.com/jdimatteo-personal-public-readaccess/nltk-2.0.5-https-distribute.tar.gz

Edit

If the wget link is broken, download ntlk 2.0.5 from pypi

like image 81
JDiMatteo Avatar answered Sep 25 '22 18:09

JDiMatteo


This is a derivative of @JDiMatteo's answer above that worked for me.

  1. wget https://pypi.python.org/packages/50/9e/39418026bf8013bbc2852c7aec3fb21e4339f6cd694934496d67a19b53b8/nltk-2.0.5.tar.gz#md5=c3f77cc1bf6c6bc85db6629b7d23c3b9
  2. tar -xzf nltk-2.0.5.tar.gz
  3. Change DEFAULT_URL from http to https in nltk-2.0.5/distribute_setup.py
  4. pip install ./nltk-2.0.5
like image 43
Rair Avatar answered Sep 23 '22 18:09

Rair