gunthercox / ChatterBot

ChatterBot is a machine learning, conversational dialog engine for creating chat bots
https://chatterbot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
14.08k stars 4.44k forks source link

ModuleNotFoundError: No module named 'chatterbot' #1859

Closed vainikshiv closed 4 years ago

vainikshiv commented 4 years ago

After i start project it gave me this below error

(env) sjain@server:~/django-chat/comedy$ python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/management/base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/management/base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/home/sjain/.local/lib/python3.7/site-packages/django/urls/resolvers.py", line 399, in check
    for pattern in self.url_patterns:
  File "/home/sjain/.local/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/urls/resolvers.py", line 584, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/urls/resolvers.py", line 577, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/sjain/django-chat/comedy/comedy/urls.py", line 19, in <module>
    from .views import home, get_response
  File "/home/sjain/django-chat/comedy/comedy/views.py", line 12, in <module>
    from chatterbot import ChatBot
ModuleNotFoundError: No module named 'chatterbot'

^C(env) sjain@server:~/django-chat/comedy$ pip3 install chatterbot-corpus
Requirement already satisfied: chatterbot-corpus in /home/sjain/.local/lib/python3.7/site-packages (1.2.0)
(env) sjain@server:~/django-chat/comedy$ python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/management/base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/management/base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
    all_namespaces = _load_all_namespaces(resolver)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
    url_patterns = getattr(resolver, 'url_patterns', [])
  File "/home/sjain/.local/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/urls/resolvers.py", line 584, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/sjain/.local/lib/python3.7/site-packages/django/urls/resolvers.py", line 577, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/sjain/django-chat/comedy/comedy/urls.py", line 19, in <module>
    from .views import home, get_response
  File "/home/sjain/django-chat/comedy/comedy/views.py", line 12, in <module>
    from chatterbot import ChatBot
ModuleNotFoundError: No module named 'chatterbot'

I have trying to install chatterbot but it gave me error and killed installation process . Kindly help me to solve this error.

^C(env) sjain@server:~/django-chat/comedy$ pip3 install chatterbot
Collecting chatterbot
  Using cached https://files.pythonhosted.org/packages/6c/0e/dac0d82f34f86bf509cf5ef3e2dfc5aa7d444bd843a2330ceb7d854f84f2/ChatterBot-1.0.5-py2.py3-none-any.whl
Requirement already satisfied: python-dateutil<2.8,>=2.7 in /usr/local/lib/python3.7/dist-packages (from chatterbot) (2.7.5)
Requirement already satisfied: mathparse<0.2,>=0.1 in /usr/local/lib/python3.7/dist-packages (from chatterbot) (0.1.2)
Requirement already satisfied: pytz in /usr/local/lib/python3.7/dist-packages (from chatterbot) (2019.3)
Requirement already satisfied: pymongo<4.0,>=3.3 in /usr/local/lib/python3.7/dist-packages (from chatterbot) (3.9.0)
Requirement already satisfied: nltk<4.0,>=3.2 in /home/sjain/.local/lib/python3.7/site-packages (from chatterbot) (3.4.5)
Requirement already satisfied: sqlalchemy<1.3,>=1.2 in /usr/local/lib/python3.7/dist-packages (from chatterbot) (1.2.19)
Collecting spacy<2.2,>=2.1 (from chatterbot)
  Using cached https://files.pythonhosted.org/packages/16/f3/554271be8ff46471586d164bfbb6999364ba30ca5a0045e2a86da5f3b2c5/spacy-2.1.9-cp37-cp37m-manylinux1_x86_64.whl
Requirement already satisfied: pint>=0.8.1 in /usr/local/lib/python3.7/dist-packages (from chatterbot) (0.9)
Requirement already satisfied: pyyaml<5.2,>=5.1 in /usr/lib/python3.7/site-packages (from chatterbot) (5.1.2)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil<2.8,>=2.7->chatterbot) (1.12.0)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /usr/local/lib/python3.7/dist-packages (from spacy<2.2,>=2.1->chatterbot) (1.0.2)
Requirement already satisfied: plac<1.0.0,>=0.9.6 in /usr/local/lib/python3.7/dist-packages (from spacy<2.2,>=2.1->chatterbot) (0.9.6)
Requirement already satisfied: thinc<7.1.0,>=7.0.8 in /usr/local/lib/python3.7/dist-packages (from spacy<2.2,>=2.1->chatterbot) (7.0.8)
Requirement already satisfied: requests<3.0.0,>=2.13.0 in /usr/lib/python3/dist-packages (from spacy<2.2,>=2.1->chatterbot) (2.21.0)
Requirement already satisfied: wasabi<1.1.0,>=0.2.0 in /usr/local/lib/python3.7/dist-packages (from spacy<2.2,>=2.1->chatterbot) (0.3.0)
Requirement already satisfied: numpy>=1.15.0 in /usr/local/lib/python3.7/dist-packages (from spacy<2.2,>=2.1->chatterbot) (1.17.3)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from spacy<2.2,>=2.1->chatterbot) (2.0.2)
Requirement already satisfied: blis<0.3.0,>=0.2.2 in /usr/local/lib/python3.7/dist-packages (from spacy<2.2,>=2.1->chatterbot) (0.2.4)
Requirement already satisfied: preshed<2.1.0,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from spacy<2.2,>=2.1->chatterbot) (2.0.1)
Requirement already satisfied: srsly<1.1.0,>=0.0.6 in /usr/local/lib/python3.7/dist-packages (from spacy<2.2,>=2.1->chatterbot) (0.1.0)
Requirement already satisfied: tqdm<5.0.0,>=4.10.0 in /usr/local/lib/python3.7/dist-packages (from thinc<7.1.0,>=7.0.8->spacy<2.2,>=2.1->chatterbot) (4.36.1)
Installing collected packages: spacy, chatterbot
Killed
gunthercox commented 4 years ago

It looks like you encountered an error during the installation process and as a result ChatterBot was not instilled. This would have resulted in the error message you've noted in the title of this issue. Digging into the error messages you've posted, it looks like the issue may be related to the spacy package.

I believe I may have corrected this issue as of the latest release (1.0.8) see #2027 for details. Essentially the solution I have decided to go with is that PyYAML is no longer going to be installed as a part of ChatterBot's default installation.

Fee free to let me know if this doesn't resolve your issue, or open a new ticket if you encounter any other problems.