ChatterBot icon indicating copy to clipboard operation
ChatterBot copied to clipboard

Quickstart procedure fails in official python:3.7 container

Open jpodivin opened this issue 4 years ago • 2 comments

The installation procedure and the basic usage example[0] are incompatible with environment of the official python:3.7 container image[1] pulled from docker hub.

The guide misses crucial step, installation of the chatterbot-corpus.

Without it the example fails, on the very first line.

Trace:

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/site-packages/chatterbot/init.py", line 4, in from .chatterbot import ChatBot File "/usr/local/lib/python3.7/site-packages/chatterbot/chatterbot.py", line 2, in from chatterbot.storage import StorageAdapter File "/usr/local/lib/python3.7/site-packages/chatterbot/storage/init.py", line 1, in from chatterbot.storage.storage_adapter import StorageAdapter File "/usr/local/lib/python3.7/site-packages/chatterbot/storage/storage_adapter.py", line 3, in from chatterbot.tagging import PosLemmaTagger File "/usr/local/lib/python3.7/site-packages/chatterbot/tagging.py", line 3, in import spacy ModuleNotFoundError: No module named 'spacy'

Different error, although with presumably the same cause, is present if the example is initiated in fresh Python 3.8.10 venv.

Trace:

Traceback (most recent call last): File "", line 1, in File "/home/user/tmp/chatbot/lib/python3.8/site-packages/chatterbot/init.py", line 4, in from .chatterbot import ChatBot File "/home/user/tmp/chatbot/lib/python3.8/site-packages/chatterbot/chatterbot.py", line 2, in from chatterbot.storage import StorageAdapter File "/home/user/tmp/chatbot/lib/python3.8/site-packages/chatterbot/storage/init.py", line 1, in from chatterbot.storage.storage_adapter import StorageAdapter File "/home/user/tmp/chatbot/lib/python3.8/site-packages/chatterbot/storage/storage_adapter.py", line 3, in from chatterbot.tagging import PosHypernymTagger File "/home/user/tmp/chatbot/lib/python3.8/site-packages/chatterbot/tagging.py", line 4, in from chatterbot.tokenizers import get_sentence_tokenizer File "/home/user/tmp/chatbot/lib/python3.8/site-packages/chatterbot/tokenizers.py", line 4, in from chatterbot.corpus import load_corpus, list_corpus_files File "/home/user/tmp/chatbot/lib/python3.8/site-packages/chatterbot/corpus.py", line 5, in from chatterbot_corpus.corpus import DATA_DIRECTORY ModuleNotFoundError: No module named 'chatterbot_corpus'

The procedure outlined in the Quickstart guide[2], when conducted in the aforementioned environments, fails with the same errors. Both Quickstart guide and the example in the README, are compromised by this issue, and require additional effort to be successfully completed.

As these are, presumably, the most simple and straightforward demonstrations of the engine usage, they most likely represent the first experience of new users and developers. As of now, however, that experience is hardly ideal, and is in fact confusing.

While the ideal situation would be the engine pulling all of it's dependencies at install time, various reasons exist why that can not be done. The next best thing however, specifying how to exactly fulfill those requirements, is feasible, and should be implemented.

[0]https://github.com/gunthercox/ChatterBot#basic-usage [1]https://hub.docker.com/layers/python/library/python/3.7/images/sha256-b6423e4fb45ba152885b613a01fad92b6b3aa40d6e8906e27d9055eda8bcfc3b [2]https://chatterbot.readthedocs.io/en/stable/quickstart.html

jpodivin avatar Aug 07 '21 09:08 jpodivin

Do you have spacy and chatterbot-corpus modules installed? If not, do pip install chatterbot-corpus and pip install spacy in CMD. Spacy should be automatically installed though.

cryokesh34 avatar Aug 18 '21 09:08 cryokesh34

That might solve your issue, but this should be included in the requirements file.

cryokesh34 avatar Aug 18 '21 09:08 cryokesh34