chatterbot isn't recognizing that I installed the library and pymongo requests setuptools in the build environment

26 Views Asked by At

So, I have a python chatterbot program (listed below) and I have all the dependencies and the chatterbot library installed, and python on my system path, and setuptools instaleld, and pip up to date, everything I can think of. But when I run it I get this.

C:\Users\ohhel> & C:/Users/ohhel/AppData/Local/Programs/Python/Python312/python.exe c:/Users/ohhel/OneDrive/Desktop/chatbot.py
Traceback (most recent call last):
  File "c:\Users\ohhel\OneDrive\Desktop\chatbot.py", line 1, in <module>
    from chatterbot import ChatBot
ModuleNotFoundError: No module named 'chatterbot'

When I try to install it I get this.

C:\Users\ohhel> pip install chatterbot
Collecting chatterbot
  Using cached ChatterBot-1.0.5-py2.py3-none-any.whl (67 kB)
Requirement already satisfied: mathparse<0.2,>=0.1 in c:\users\ohhel\appdata\local\programs\python\python312\lib\site-packages (from chatterbot) (0.1.2)
Requirement already satisfied: nltk<4.0,>=3.2 in c:\users\ohhel\appdata\local\programs\python\python312\lib\site-packages (from chatterbot) (3.8.1)
Requirement already satisfied: pint>=0.8.1 in c:\users\ohhel\appdata\local\programs\python\python312\lib\site-packages (from chatterbot) (0.23)
Collecting pymongo<4.0,>=3.3 (from chatterbot)
  Using cached pymongo-3.13.0.tar.gz (804 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I already have python on my system path and setuptools installed. If you have a solution please let me know. Here's the bot itself:

from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer

# Create a chatbot instance
chatbot = ChatBot('MyChatBot')

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

# Train the chatbot on the English language corpus data
trainer.train('chatterbot.corpus.english')

# Add custom conversations to the chatbot
chatbot.train([
    'How are you?', 'I am good.',
    'What is your name', 'Chatbot.'
])

# Start chatting loop
print("Hi there! Type 'bye' to exit.")
while True:
    user_input = input("You: ")
    if user_input.lower() == 'bye':
        print("Chatbot: Goodbye! Have a great day.")
        break
    response = chatbot.get_response(user_input)
    print("Chatbot:", response)
0

There are 0 best solutions below