title: Setting up ntlk proxy
body: <p>I was following  first chapter of the <a href="http://www.nltk.org/book/ch01.html#frequency-distributions" rel="nofollow noreferrer">nltk book</a>. It asks us to install book corpus by running <code>nltk.dowwnload()</code>.</p>
  
  <p>I am getting <code>getattrinfo failed</code> error while doing <code>ntlk.download()</code>. After reading online, I came to know that this has something to do with my proxy.</p>
  
  <p><a href="https://i.stack.imgur.com/KL7yj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KL7yj.png" alt="enter image description here"></a></p>
  
  <p>So I tried setting proxies in different ways (trying <code>http</code> or <code>https</code>, <code>%40</code> or <code>@</code> in password):</p>
  
  <pre><code>nltk.set_proxy('http://proxy.mycompany.com:8080',('123456','password%40123'))
  nltk.set_proxy('http://proxy.mycompany.com:8080',('123456','password@123'))
  nltk.set_proxy('https://proxy.mycompany.com:8080',('123456','password%40123'))
  nltk.set_proxy('https://proxy.mycompany.com:8080',('123456','password@123'))
  </code></pre>
  
  <p>(I was able to succesfully set proxy for <code>pip</code> and install <code>nltk</code>, but not sure if I am making mistake in case of <code>nltk</code> proxy)</p>
  
  <p>Then I also tried</p>
  
  <pre><code>C:\Users\123456&gt;python -m nltk.downloader all
  [nltk_data] Error loading all: &lt;urlopen error [Errno 11004]
  [nltk_data]     getaddrinfo failed&gt;
  Error installing package. Retry? [n/y/e]
  </code></pre>
  
  <p>Next I tried </p>
  
  <pre><code>&gt;&gt;&gt;nltk.download('book') 
  </code></pre>
  
  <p>But this too gives same error:</p>
  
  <pre><code>&gt;&gt;&gt; nltk.download('book')
  [nltk_data] Error loading book: &lt;urlopen error [Errno 11004]
  [nltk_data]     getaddrinfo failed&gt;
  </code></pre>
  
  <p>Then I also tried by changing server index url as suggested <a href="https://stackoverflow.com/a/27764910/1317018">here</a>, but no use. Also the <a href="https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml" rel="nofollow noreferrer">pre populated index is alive</a> (and I am able to open it in the browser), so I guess I need not change server index url.</p>