1

I am using python 3.7.2. I downloaded chatterbot using:

pip install -U chatterbot==1.0.4

but the code doesn't recognise chatterbot but it recognises ChatterBot, but when ran, I get this error:

File "e:/PythonProjects/Projects/ChatterBot/Bot.py", line 3, in <module>
from ChatterBot import ChatBot
ModuleNotFoundError: No module named 'ChatterBot'

Why is this? Full code:

from ChatterBot import ChatBot
chatbot = ChatterBot.ChatBot("Chatpot")

exit_conditions = (":q", "quit", "exit")
while True:
 query = input("> ")
 if query in exit_conditions:
    break
 else:
    print(f" {chatbot.get_response(query)}")
turtlesXD
  • 53
  • 6

1 Answers1

1

Looking at the PyPi entry for chatterbot, the basic usage section says the following:

from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer

chatbot = ChatBot('Ron Obvious')

# Create a new trainer for the chatbot
trainer = ChatterBotCorpusTrainer(chatbot)

# Train the chatbot based on the english corpus
trainer.train("chatterbot.corpus.english")

# Get a response to an input statement
chatbot.get_response("Hello, how are you today?")

So you should use chatterbot and not ChatterBot when importing the module.

Additionally, when using the -U flag in pip install it upgrades the package to the newest available version. So drop the flag if you want to install a specific version.

Marcelo Paco
  • 2,732
  • 4
  • 9
  • 26