asayeda25
asayeda25

Reputation: 1

Errno 2 No such file or directory: '/root/chatterbot_corpus/data/english/' in google colab

I am trying to create a simple chatbot in Google Colab. The code ran successfully for the first time, but when I tried to run it again the next day it shows the following error :-


FileNotFoundError Traceback (most recent call last) in () 4 5 trainer= ChatterBotCorpusTrainer(chatbot) ----> 6 trainer.train ("chatterbot.corpus.english")

2 frames /usr/local/lib/python3.7/dist-packages/chatterbot/corpus.py in read_corpus(file_name) 56 raise OptionalDependencyImportError(message) 57 ---> 58 with io.open(file_name, encoding='utf-8') as data_file: 59 return yaml.load(data_file) 60

FileNotFoundError: [Errno 2] No such file or directory: '/root/chatterbot_corpus/data/english'

I had not made any changes in the code. What is the problem?

    pip install chatterbot
    pip install chatterbot_corpus
    from chatterbot import ChatBot
    from chatterbot.trainers import ChatterBotCorpusTrainer
    chatbot = ChatBot('mybot')


    trainer= ChatterBotCorpusTrainer(chatbot)
    trainer.train("chatterbot.corpus.english")

Upvotes: 0

Views: 2763

Answers (1)

seric sheon
seric sheon

Reputation: 95

This error arises when you get connected to a new runtime as it does not contain any of the pre-installed packages or files. I would suggest keeping the pip install commands in different code block and running it first then running the code also if you had any files in directory you gotta reupload it.

So I just ran your code in my colab and the problem is this:

!pip install chatterbot
!pip install chatterbot_corpus

just add the '!' before and it will work'.

Upvotes: 3

Related Questions