chamkank / flask-chatterbot

Simple boilerplate for ChatterBot using Flask
378 stars 263 forks source link

If I upgrade the modules to the latest version it shows various errors #5

Closed anilneeluri closed 7 years ago

anilneeluri commented 7 years ago

How can it be solved if I upgrade it to the latest version

gunthercox commented 7 years ago

@anilneeluri You should include a copy of the errors you are getting so that we can help you.

anilneeluri commented 7 years ago

Firstly I did not find a way to use the storage adapters in the Chatbot of that version of the chatterbot(0.3.6). How can it be done?(if the storage adapters are present in that version)

edwardinubuntu commented 7 years ago

Chatterbot has latest version 0.7.5, you can use pip3 to install.

$pip3 show chatterbot Name: ChatterBot Version: 0.7.5 Summary: Home-page: None Author: None Author-email: None License: None Location: /usr/local/lib/python3.6/site-packages Requires: nltk, python-twitter, jsondatabase, pymongo, sqlalchemy, python-dateutil, chatterbot-corpus

If you use storage adapter like mongo db, needed to setup reference parameter for it while building chatbot.

mongodb_name = os.environ.get('MONGODB_NAME')
mongodb_uri = os.environ.get('MONGODB_URI')
my_bot = ChatBot("my_bot",
                     storage_adapter='chatterbot.storage.MongoDatabaseAdapter',
                     logic_adapters=[
                         {
                             'import_path': "chatterbot.logic.BestMatch"
                         }
                     ],
                     database=mongodb_name,
                     database_uri=mongodb_uri
                     )

You may find those keyword in self.kwargs.get https://github.com/gunthercox/ChatterBot/blob/master/chatterbot/storage/mongodb.py

gunthercox commented 7 years ago

@anilneeluri What command did you use to do the upgrade?

anilneeluri commented 7 years ago

I used "pip install chatterbot --upgrade" to get it upgraded from the older version as I installed the older version 0.3.6 for the sake of this project

gunthercox commented 7 years ago

Try the following. Let me know if you get any errors in your terminal when running them.

 pip uninstall chatterbot
 pip install chatterbot --no-cache-dir
anilneeluri commented 7 years ago

pardon me. I did it by using pycharm interpreter. If I use the above command it upgrades the related modules with it. So had to do it using Pycharm interpreter.

gunthercox commented 7 years ago

Are you also running your code in Pycharm? I'm fairly certain that Pycharm also installs Python 3.

I'd recommend making sure that your python interpreter is set to the correct version of Python in pycharm. https://www.jetbrains.com/help/pycharm/2017.1/configuring-python-interpreter-for-a-project.html

One reason that you may be seeing this issue because the old version of ChatterBot is installed for Python 3 but the code is being executed in Python 2.7


This is a difficult error to debug, but it might help to try running these commands without Pycharm so that you can be sure of the Python environment.

anilneeluri commented 7 years ago

It works. Thanks.