python chatterbot [nltk_data] Error loading stopwords: <urlopen error [Errno 11004]

The following error occurred while running the project:

[nltk_data] Error loading stopwords: <urlopen error [Errno 11004]
[nltk_data]     getaddrinfo failed>
[nltk_data] Error loading averaged_perceptron_tagger: <urlopen error
[nltk_data]     [Errno 11004] getaddrinfo failed>

The Solution is as follows:

Go to:

Go to the directory /packages/corpora/ and find the corresponding file and put it under the corresponding file

It is recommended that the entire nltk_data project is downloaded with a size of 695M to avoid other problems that cannot be downloaded!

Extract the zip file\nltk_data-gh-pages\packages

all files to the following directory


Here the installation directory may be different for each person, here I am in the above directory.

Modify the corresponding file.

\venv\Lib\site-packages\chatterbot\ under the current project directory

(Some children’s directory may not be under the current project, you can find the corresponding site-packages directory according to your own configuration and then find the corresponding files to modify)

The corresponding code nltk_download_corpus(‘xxx’) needs to be modified as follows:

def download_nltk_stopwords():
    Download required NLTK stopwords corpus if it has not already been downloaded.

def download_nltk_wordnet():
    Download required NLTK corpora if they have not already been downloaded.

def download_nltk_averaged_perceptron_tagger():
    Download the NLTK averaged perceptron tagger that is required for this algorithm
    to run only if the corpora has not already been downloaded.

def download_nltk_vader_lexicon():
    Download the NLTK vader lexicon for sentiment analysis
    that is required for this algorithm to run.


Read More: