Fixing error while installing nltk supporting packages : nltk.download() ( getaddrinfo failed )

Error while installing nltk supporting packages : nltk.download() ( getaddrinfo failed ) is an error which sometimes occurs because of a faulty nltk installation.

In the blog post I attempt to explain why this error takes place and how you can solve it, I will also add other solutions that could solve the error if possible.

Exploring the Error : error while installing nltk supporting packages : nltk.download() ( getaddrinfo failed )

This is an error which sometimes occurs because of a faulty nltk installation.

The error message should look like the error message bellow.

                                                                       #
[nltk_data] Error loading all: <urlopen error [Errno 11001]
[nltk_data]     getaddrinfo failed>
                                                                       #

Bellow is a number of tested solutions that I have tried and have worked for me.

Solution 1 : Change the Server Index in the NLTK downloader

Usually this is a faulty Nltk installation causing the error. The solution is to change the Server Index in the NLTK downloader.

In the NLTK Downloader window, click on File , after that click on Change Server Index.

Remove the URL you found there and use this one instead : http://nltk.org/nltk_data/

If this method did not fix the problem try the method bellow instead.

Solution 2 : downloaded the required corpora

NLTK has built-in support for dozens of corpora and trained models, . Which you can use within NLTK.

The team recommends using the NLTK corpus downloader

Run the Python interpreter and type the commands bellow

                                                                       #
import nltk
                                                                       #
                                                                       #
nltk.download()
                                                                       #

Download the required corpora from this link : http://www.nltk.org/nltk_data/

Voila, your error should be gone by now, Thank you for reading this blog post.

Summing-up : 

This is it, it is the end of our article, I hope I helped you solve the Python error : error while installing nltk supporting packages nltk.download , getaddrinfo failed , a simple upgrade will usually solve this issue. Do not give up, keep coding and learning, cheers.

If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/