0

I tried to download nltk but keep on get error as below:

import nltk
nltk.download()

Error:

[Errno 11001] getaddrinfo failed

After I click the "ok" button, "NLTK Downloader" screen is showing: enter image description here

Ling
  • 349
  • 5
  • 15
  • maybe this is relevant https://stackoverflow.com/questions/27750608/error-installing-nltk-supporting-packages-nltk-download – Somya Avasthi Dec 12 '19 at 07:14

3 Answers3

1

you might need to change your directory first and then try to install it. as in my case while I was trying to install pip on my computer it was not in the correct directory. you might need to find the path of directory and then change your directory and then try to install it again.

1

Alright Guys, after trying out all the solutions out on the web, This is what finally worked.

I tried it only on windows, will update if I try on mac.

On Windows 11: (This might work on windows 10 too)

  1. Go to C:\Windows\system32\drivers\etc

  2. Right click and select open in terminal(if terminal is set to open by default as administrator) or open terminal or cmd as administrator and cd into the above path (C:\Windows\system32\drivers\etc)

  3. type notepad hosts into the prompt and press enter.

  4. Now go to https://ipaddress.com

  5. type whatever url server address is in the nltk downloader window. In my case, it was raw.githubusercontent.com.

  6. You can see the IP addresses raw.githubusercontent.com is using. In my case, it was IPv4 Addresses: 185.199.108.133, 185.199.109.133, 185.199.110.133, 185.199.111.133.

  7. now add the any one IP address and raw.githubusercontent.com seperated by a space. (Instructions are provided in the hosts file)

  8. Now go and run nltk.download() again. This time it should show all the packages. Just hit download and voila.

Final Result

0

I worked it out by manually download package from below site https://github.com/nltk/nltk_data/tree/gh-pages/packages

unzip and save to a folder:

C:\Users\xxxxxx\AppData\Roaming\nltk_data\corpora\stopwords

Thank you all for your help.

Ling
  • 349
  • 5
  • 15