pythoninstallationcondapyyamlchatterbot

Chatterbot corpus not found


I'm trying to build a simple chatbot using Chatterbot and use it's corpus.

from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer

chatbot = ChatBot('Charlie')

corpus_trainer = ChatterBotCorpusTrainer(chatbot)
corpus_trainer.train('chatterbot.corpus.english')


response = chatbot.get_response(input())

print(response)

When I run, I get an error saying No such file or directory for the english corpus.

So I've tried installing chatterbot corpus by running pip install chatterbot_corpus, but keep getting the following error

ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

I have also run conda remove PyYAML and tried again but still get the same error.


Solution

  • It would help to know what OS are you on. Because on Linux there is chance that PyYAML has been installed by OS and should be managed by OS-specific package manager.

    Either way, you can just run pip with --ignore-installed switch and see what happens:

    pip install --ignore-installed chatterbot_corpus
    

    You can find more information on the nature of this error and more hints on the resolution in this elaborate answer.