Skip to content Skip to sidebar Skip to footer

Can Not Install Chatterbot In Anaconda

While installing chatterbot in Anaconda using Python 3.7 I am getting the following error: Found existing installation: PyYAML 3.13 Cannot uninstall 'PyYAML'. It is a distutils

Solution 1:

Installing chatterbot in conda environment using Python 3.7

  • Create new conda environment with Python 3.7
conda create--name chatterbot_example python=3.7
  • Activate the environment:
source activate chatterbot_example
  • Install chatterbot and chatterbot-corpus inside the environment:
pip install chatterbot
pip install chatterbot-corpus
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 statementprint(chatbot.get_response("Hello, how are you today?"))
  • Run the program:
python example.py

Output:

pythonexample.py
[nltk_data] Downloadingpackagestopwordsto/home/cefalo/nltk_data...
[nltk_data]   Packagestopwordsisalreadyup-to-date!
[nltk_data] Downloadingpackageaveraged_perceptron_taggerto
[nltk_data]     /home/cefalo/nltk_data...
[nltk_data]   Packageaveraged_perceptron_taggerisalreadyup-to-
[nltk_data]       date!Training ai.yml: [####################] 100%Training botprofile.yml: [####################] 100%Training computers.yml: [####################] 100%Training conversations.yml: [####################] 100%Training emotion.yml: [####################] 100%Training food.yml: [####################] 100%Training gossip.yml: [####################] 100%Training greetings.yml: [####################] 100%Training health.yml: [####################] 100%Training history.yml: [####################] 100%Training humor.yml: [####################] 100%Training literature.yml: [####################] 100%Training money.yml: [####################] 100%Training movies.yml: [####################] 100%Training politics.yml: [####################] 100%Training psychology.yml: [####################] 100%Training science.yml: [####################] 100%Training sports.yml: [####################] 100%Training trivia.yml: [####################] 100%Tellmeajoke

System information:

  • OS : Ubuntu 16.04 LTS
  • Processor : Intel® Core™ i7-4600M

Conda version information:

conda --version
conda 4.5.11

Installed packages:

attrs==19.1.0blis==0.2.4certifi==2019.3.9chardet==3.0.4ChatterBot==1.0.5chatterbot-corpus==1.2.0cymem==2.0.2idna==2.8jsonschema==3.0.1mathparse==0.1.2murmurhash==1.0.2nltk==3.4.1numpy==1.16.3Pint==0.9plac==0.9.6preshed==2.0.1pymongo==3.8.0pyrsistent==0.15.2python-dateutil==2.7.5pytz==2019.1PyYAML==3.13requests==2.22.0six==1.12.0spacy==2.1.4SQLAlchemy==1.2.19srsly==0.0.5thinc==7.0.4tqdm==4.32.1urllib3==1.25.2wasabi==0.2.2

Solution 2:

Update on the solution @arsho shared.

For conda versions before 4.6, use:

  • Windows: activate snakes
  • macOS & Linux: source activate snakes

For conda versions 4.6 and later, use:

  • Windows, macOS, Linux: conda activate snakes

Solution 3:

Conda YAML

A simpler install would be to use a YAML, which also will be significantly faster since all Conda package builds are precompiled:

chatterbot.yaml

name:chatterbotchannels:-conda-forgedependencies:## python core-python=3.7-pip## dependencies-python-dateutil=2.8-pytz-pyyaml>=3.12,<4.0-six>=1.5-spacy=2.1-sqlalchemy=1.3## pip installs-pip:-chatterbot-chatterbot-corpus

Install

conda env create -n chatterbot -f chatterbot.yaml

Run

Note that to run the example in @arsho's answer, I required first

conda activate chatterbot

## install English (only needed once)
python -m spacy download en

Then python example.py works similarly.

Post a Comment for "Can Not Install Chatterbot In Anaconda"