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:
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:
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.
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)
Go to C:\Windows\system32\drivers\etc
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)
type notepad hosts
into the prompt and press enter.
Now go to https://ipaddress.com
type whatever url server address is in the nltk downloader window. In my case, it was raw.githubusercontent.com.
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.
now add the any one IP address and raw.githubusercontent.com seperated by a space. (Instructions are provided in the hosts file)
Now go and run nltk.download()
again. This time it should show all the packages. Just hit download and voila.
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.