Chatterbot: its wont run

Created on 28 Jan 2019  路  8Comments  路  Source: gunthercox/ChatterBot

os: ubuntu 18.10
bot version 1.0.1
python : 3.6

error

[nltk_data] Downloading package averaged_perceptron_tagger to
[nltk_data]     /home/ghost/nltk_data...
[nltk_data]   Unzipping taggers/averaged_perceptron_tagger.zip.
[nltk_data] Downloading package punkt to /home/ghost/nltk_data...
[nltk_data]   Unzipping tokenizers/punkt.zip.
[nltk_data] Downloading package stopwords to /home/ghost/nltk_data...
[nltk_data]   Unzipping corpora/stopwords.zip.
[nltk_data] Downloading package wordnet to /home/ghost/nltk_data...
[nltk_data]   Unzipping corpora/wordnet.zip.
List Trainer: [####################] 100%
Traceback (most recent call last):
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
    context)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: table statement has no column named search_text

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "index.py", line 12, in <module>
    "Your flight has been booked."
  File "/usr/local/lib/python3.6/dist-packages/chatterbot/trainers.py", line 120, in train
    self.chatbot.storage.create_many(statements_to_create)
  File "/usr/local/lib/python3.6/dist-packages/chatterbot/storage/sql_storage.py", line 264, in create_many
    session.commit()
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 954, in commit
    self.transaction.commit()
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 467, in commit
    self._prepare_impl()
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 447, in _prepare_impl
    self.session.flush()
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2313, in flush
    self._flush(objects)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2440, in _flush
    transaction.rollback(_capture_exception=True)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 249, in reraise
    raise value
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2404, in _flush
    flush_context.execute()
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py", line 395, in execute
    rec.execute(self)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py", line 560, in execute
    uow
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj
    mapper, table, insert)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py", line 872, in _emit_insert_statements
    execute(statement, params)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 948, in execute
    return meth(self, multiparams, params)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context
    context)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
    exc_info
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 248, in reraise
    raise value.with_traceback(tb)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
    context)
  File "/home/ghost/.local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table statement has no column named search_text [SQL: 'INSERT INTO statement (text, search_text, conversation, created_at, in_response_to, search_in_response_to, persona) VALUES (?, ?, ?, ?, ?, ?, ?)'] [parameters: ('Hi, can I help you?', 'PRP:support', 'training', '2019-01-28 16:07:49.895579', None, '', '')] (Background on this error at: http://sqlalche.me/e/e3q8)
my bot code

from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer

# Create a new chat bot named Charlie
chatbot = ChatBot('Charlie')

trainer = ListTrainer(chatbot)

trainer.train([
    "Hi, can I help you?",
    "Sure, I'd like to book a flight to Iceland.",
    "Your flight has been booked."
])

# Get a response to the input text 'I would like to book a flight.'
response = chatbot.get_response('I would like to book a flight.')

print(response)

why its happen any one here for help me?

All 8 comments

@Ghost173 I'm interested to know, did you previously have a different version of ChatterBot installed?

no this is the my first try

Okay, interesting. I will test out version 1.0.1 to try to recreate this issue.

its create db.sqlite3 sql file in project folder i delete and retry its work (1st time am not sure what is the sql file name )

and one more information i use pip3 not pip

pip3 install chatterbot

python --version : Python 2.7.15+ 
python3 --version : Python 3.6.7
pip --version  :pip 18.1 
pip3 --version  : pip 9.0.1 

python3 -m chatterbot --version out put is 1.0.1
may be this information will help to you :)

Hi @Ghost173 I can't seem to recreate the error that you encountered. I'll post the steps and details related to my test environment below. Perhaps there will be a detail in there that is of help.

  1. I created a new workspace and Python file
mkdir new_workspace
cd new_workspace
touch testing.py
  1. I made sure I had the latest version of ChatterBot 1.0 installed
sudo python3 -m pip install chatterbot --upgrade
  1. I pasted your code from the ticket above into testing.py and saved the file.
  2. I ran testing.py and got the following output.
python3 testing.py
List Trainer: [####################] 100%
Your flight has been booked.

I am using Python 3.6.6

i try to re produce my issue but i coudnt i;m still try if i reproduce this error ill share those steps thank you now iam closing this issues

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hemangsk picture hemangsk  路  4Comments

decode007 picture decode007  路  3Comments

cesarandreslopez picture cesarandreslopez  路  4Comments

gunthercox picture gunthercox  路  3Comments

yuvalBor picture yuvalBor  路  3Comments