3

I have installed NLTK module but when I try to install the data I am getting the error below.

enter image description here

>>>import nltk
>>> nltk.download('punkt')
[nltk_data] Error loading punkt: <urlopen error [Errno 11004]
[nltk_data]     getaddrinfo failed>
False

How should I install the data?

Community
  • 1
  • 1
shan
  • 467
  • 4
  • 9
  • 20
  • 1
    Just type in `nltk.download()` and then find the package you want. Error message implies to me that the package isn't called `punkt`, which I believe is the case. It's called something else. – Slater Victoroff Aug 08 '17 at 16:47
  • 1
    A [lot of useful hints](https://stackoverflow.com/questions/30822131/nltk-package-errors-punkt-and-pickle) what might have gone wrong. – sophros Aug 08 '17 at 16:50
  • tried nltk.download() - error 11004 - getaddrinfo failed – shan Aug 08 '17 at 16:53
  • This seems like [DNS issue](https://stackoverflow.com/questions/5022945/urllib2-urlerror-urlopen-error-errno-11004-getaddrinfo-failed). Could you check HTTP proxy existence in your setup or change it temporarily to download the data? – sophros Aug 08 '17 at 17:05
  • https://stackoverflow.com/questions/7334199/getaddrinfo-failed-what-does-that-mean – alvas Aug 09 '17 at 12:42

4 Answers4

1

The issue might be of the Proxy that is setup in the system.

instead of:

>>import nltk
>>nltk.download()

use:

>>nltk.set_proxy('SYSTEM PROXY')
>>nltk.download()

This should solve the problem. And to find the proxy of the system: search proxy in start option of windows.

S.B
  • 13,077
  • 10
  • 22
  • 49
Ranjeet
  • 21
  • 2
1

I understand this is a very old question but wanted to share my experience for anyone who may experience this situation in future. What i did was (in windows 10) -

  1. open command prompt.
  2. set proxies using command:
    set HTTP_PROXY=http://userid:password@proxyurl:port
    set HTTPS_PROXY=http://userid:password@proxyurl:port
    set FTP_PROXY=http://userid:password@proxyurl:port
    
  3. run command:
    python -m nltk.downloader
    
S.B
  • 13,077
  • 10
  • 22
  • 49
Sujoy
  • 1,186
  • 1
  • 9
  • 12
1

I have been struggling with the error from past few days. This little code helped me solve error :

from nltk.corpus import stopwords
0
import socket

socket.getaddrinfo( 'localhost', 8080)

import nltk

nltk.download('all')
toyota Supra
  • 3,181
  • 4
  • 15
  • 19
  • 3
    Answer needs supporting information Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](https://stackoverflow.com/help/how-to-answer). – moken Aug 03 '23 at 10:00
  • Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?** – Jeremy Caney Aug 05 '23 at 00:20