How to Fix NLTK Downloader Error [Error 11004] Getaddrinfo Failed

When opening the NLTK downloader, a pop-up window shows the message [Error 11004] getaddrinfo failed.

# Open NLTK downloader
import nltk
nltk.download()

How to Fix NLTK Downloader Error [Error 11004] Getaddrinfo Failed

What should be done when this problem occurs? Many people go down the wrong path, wasting a lot of time on it.

First, return to the code, where the output message has already been displayed. Click to open the output URL.

How to Fix NLTK Downloader Error [Error 11004] Getaddrinfo Failed

It is found that the URL cannot be opened, which is actually an error of “unable to find the server IP address for raw.githubusercontent.com”.

How to Fix NLTK Downloader Error [Error 11004] Getaddrinfo Failed

Find the hosts file in the path C:\Windows\System32\drivers\etc, and add the line 199.232.68.133 raw.githubusercontent.com at the end, then save it. Now, when you open the NLTK downloader again, it should work normally, as shown in the picture:

How to Fix NLTK Downloader Error [Error 11004] Getaddrinfo Failed

How to Fix NLTK Downloader Error [Error 11004] Getaddrinfo Failed

If the IP address for raw.GitHub changes frequently, check the IP address of that URL before modifying the hosts file. Open the IP address query website: https://www.ipaddress.com/

Enter the following code and press Enter:

raw.githubusercontent.com

How to Fix NLTK Downloader Error [Error 11004] Getaddrinfo Failed

You will get the IP address 199.232.68.133, and then modify the hosts file as in the previous step.

How to Fix NLTK Downloader Error [Error 11004] Getaddrinfo Failed

end

How to Fix NLTK Downloader Error [Error 11004] Getaddrinfo Failed

Leave a Comment