AICoE / sefkhet-abwy

This is one of the incarnations of Sesheta
GNU General Public License v3.0
5 stars 13 forks source link

ChatBot is failing to start #178

Closed codificat closed 2 years ago

codificat commented 2 years ago

Describe the bug

The latest version of sefkhet-abwy-chatbot, v0.22.2 (#175), is in a crashloop

To Reproduce Steps to reproduce the behavior:

  1. Go to ArgoCD
  2. Find the sefkhet-abwy-chatbot, notice the pod in crashloopbackoff
  3. Look at the deploymentconfig and check the logs
  4. See error:
{"name": "thoth.common", "levelname": "WARNING", "module": "logging", "lineno": 344, "funcname": "init_logging", "created": 1634720261.362705, "asctime": "2021-10-20 08:57:41,362", "msecs": 362.7049922943115, "relative_created": 2182.8553676605225, "process": 1, "message": "Logging to a Sentry instance is turned off"}
Traceback (most recent call last):
  File "/opt/app-root/src/chatbot", line 31, in <module>
    from aicoe.sesheta.actions.chat import process_user_text, CHATBOT
  File "/opt/app-root/src/aicoe/sesheta/actions/chat.py", line 53, in <module>
    CHATBOT = ChatBot("Sesheta", read_only=True)
  File "/opt/app-root/lib64/python3.8/site-packages/chatterbot/chatterbot.py", line 28, in __init__
    self.storage = utils.initialize_class(storage_adapter, **kwargs)
  File "/opt/app-root/lib64/python3.8/site-packages/chatterbot/utils.py", line 33, in initialize_class
    return Class(*args, **kwargs)
  File "/opt/app-root/lib64/python3.8/site-packages/chatterbot/storage/sql_storage.py", line 20, in __init__
    super().__init__(**kwargs)
  File "/opt/app-root/lib64/python3.8/site-packages/chatterbot/storage/storage_adapter.py", line 22, in __init__
    self.tagger = Tagger(language=kwargs.get(
  File "/opt/app-root/lib64/python3.8/site-packages/chatterbot/tagging.py", line 26, in __init__
    self.nlp = spacy.load(self.language.ISO_639_1.lower())
  File "/opt/app-root/lib64/python3.8/site-packages/spacy/__init__.py", line 51, in load
    return util.load_model(
  File "/opt/app-root/lib64/python3.8/site-packages/spacy/util.py", line 327, in load_model
    raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name]))
OSError: [E941] Can't find model 'en'. It looks like you're trying to load a model from a shortcut, which is obsolete as of spaCy v3.0. To load the model, use its full name instead:

nlp = spacy.load("en_core_web_sm")

For more details on the available models, see the models directory: https://spacy.io/models. If you want to create a blank model, use spacy.blank: nlp = spacy.blank("en")
codificat commented 2 years ago

The upgrade of spacy to >=3.0 was in d8b330db94f502e293797e32e52fef07903beea8

harshad16 commented 2 years ago

This feature is deprecated in the spacy 3.0, https://github.com/AICoE/sefkhet-abwy/blob/642862a3353bc73851c44c4ee18ecca8c2ad22a3/.s2i/bin/assemble#L7

that gives this issue:

DeprecationWarning: The command link is deprecated.
⚠ As of spaCy v3.0, model symlinks are not supported anymore. You can
load trained pipeline packages using their full names or from a directory
path.
harshad16 commented 2 years ago

As this deprecated in spacy >3.x , we would have to update the language model version and update the chatterbot package to use the correct spacy feature. which seems to be extra work for the simple issue.

Instead of fixing the bot, we would downgrade the version of spacy which is causing the issue. we know the chat bot worked with the spacy ==2.3.5 , we would pin down the app to this version.