gunthercox/chatterbot-corpus

Update Pyyaml to match chatterbot

jghyllebert opened this issue · 23 comments

I just started using chatterbot,

It does not install chatterbot-corpus as a dependency after running pipenv install chatterbot.

In [1]: from chatterbot import ChatBot                                                                                                                                                                             
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-22d2a9e85e25> in <module>
----> 1 from chatterbot import ChatBot

~/.local/share/virtualenvs/chatterbot-test-H1-ATVUx/lib/python3.7/site-packages/chatterbot/__init__.py in <module>
      2 ChatterBot is a machine learning, conversational dialog engine.
      3 """
----> 4 from .chatterbot import ChatBot
      5 
      6 __version__ = '1.0.5'

~/.local/share/virtualenvs/chatterbot-test-H1-ATVUx/lib/python3.7/site-packages/chatterbot/chatterbot.py in <module>
      1 import logging
----> 2 from chatterbot.storage import StorageAdapter
      3 from chatterbot.logic import LogicAdapter
      4 from chatterbot.search import IndexedTextSearch
      5 from chatterbot import utils

~/.local/share/virtualenvs/chatterbot-test-H1-ATVUx/lib/python3.7/site-packages/chatterbot/storage/__init__.py in <module>
----> 1 from chatterbot.storage.storage_adapter import StorageAdapter
      2 from chatterbot.storage.django_storage import DjangoStorageAdapter
      3 from chatterbot.storage.mongodb import MongoDatabaseAdapter
      4 from chatterbot.storage.sql_storage import SQLStorageAdapter
      5 

~/.local/share/virtualenvs/chatterbot-test-H1-ATVUx/lib/python3.7/site-packages/chatterbot/storage/storage_adapter.py in <module>
      1 import logging
      2 from chatterbot import languages
----> 3 from chatterbot.tagging import PosHypernymTagger
      4 
      5 

~/.local/share/virtualenvs/chatterbot-test-H1-ATVUx/lib/python3.7/site-packages/chatterbot/tagging.py in <module>
      2 from chatterbot import languages
      3 from chatterbot import utils
----> 4 from chatterbot.tokenizers import get_sentence_tokenizer
      5 from nltk import pos_tag
      6 from nltk.corpus import wordnet, stopwords

~/.local/share/virtualenvs/chatterbot-test-H1-ATVUx/lib/python3.7/site-packages/chatterbot/tokenizers.py in <module>
      2 from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktTrainer
      3 from nltk.tokenize import _treebank_word_tokenizer
----> 4 from chatterbot.corpus import load_corpus, list_corpus_files
      5 from chatterbot import languages
      6 

~/.local/share/virtualenvs/chatterbot-test-H1-ATVUx/lib/python3.7/site-packages/chatterbot/corpus.py in <module>
      3 import glob
      4 import yaml
----> 5 from chatterbot_corpus.corpus import DATA_DIRECTORY
      6 
      7 

ModuleNotFoundError: No module named 'chatterbot_corpus'

(which should probably an issue in Chatterbot)

Then when I try to install chatterbot-corpus I get the following error:

Installing chatterbot_corpus…
Collecting chatterbot-corpus
  Using cached https://files.pythonhosted.org/packages/ed/19/f8b41daf36fe4b0f43e283a820362ffdb2c1128600ab4ee187e84262fa4d/chatterbot_corpus-1.2.0-py2.py3-none-any.whl
Collecting PyYAML<4.0,>=3.12 (from chatterbot-corpus)
  Using cached https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz
Building wheels for collected packages: PyYAML
  Building wheel for PyYAML (setup.py): started
  Building wheel for PyYAML (setup.py): finished with status 'done'
  Stored in directory: /home/jonas/.cache/pipenv/wheels/ad/da/0c/74eb680767247273e2cf2723482cb9c924fe70af57c334513f
Successfully built PyYAML
Installing collected packages: PyYAML, chatterbot-corpus
  Found existing installation: PyYAML 5.1
    Uninstalling PyYAML-5.1:
      Successfully uninstalled PyYAML-5.1
Successfully installed PyYAML-3.13 chatterbot-corpus-1.2.0

Adding chatterbot_corpus to Pipfile's [packages]…
Pipfile.lock (6f58d5) out of date, updating to (2ccbda)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…

Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
Could not find a version that matches pyyaml<4.0,<5.2,>=3.12,>=5.1
Tried: 3.10, 3.10, 3.11, 3.11, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 5.1, 5.1, 5.1, 5.1, 5.1, 5.1, 5.1, 5.1, 5.1, 5.1, 5.1
Skipped pre-versions: 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 4.2b1, 4.2b2, 4.2b4, 4.2b4, 4.2b4, 4.2b4, 4.2b4, 5.1b1, 5.1b3, 5.1b5, 5.1b5, 5.1b5, 5.1b5, 5.1b5, 5.1b5, 5.1b5, 5.1b5, 5.1b5, 5.1b5, 5.1b5, 5.1b7
There are incompatible versions in the resolved dependencies.

Notice how installing uninstalled the pyyaml version for chatterbot.
Running pipenv graph show there's a conflict in dependencies:

ChatterBot==1.0.5
  ...
  - pyyaml [required: >=5.1,<5.2, installed: 3.13]
  ...
chatterbot-corpus==1.2.0
  - PyYAML [required: >=3.12,<4.0, installed: 3.13]

Momentarily gets fixed by installing from source:

pipenv install git+https://github.com/gunthercox/chatterbot-corpus.git#egg=chatterbot-corpus

I guess all that would be needed is a version bump and pypi release.

How did you solve it ?? I ge the same error descrption-....

First I uninstalled chatterbot-corpus then installed from source using: pipenv install git+https://github.com/gunthercox/chatterbot-corpus.git#egg=chatterbot-corpus

Installing from source is not working. Help
Giving an error of not having an "egg" stuff

@PrinceChukz What commands did you use?

pip install git source

You have to install chatterbot_corpus and not chatterbot-corpus
pip install chatterbot_corpus
or
pip3 install chatterbot_corpus

image
not working

the message clearly suggesting you have pyyaml 3.13 which is incompatible for chatterbot which requires 1.0.5

Either you have to ignore this error or you need to manually uninstall PyYaml for your machine.

pip3 uninstall PyYAML

if not you could simply delete PyYAML folder from site-packages directory.

image

please advise how to install

Came here looking for a solution, found myself experiencing similar problem.
python --version
Python 3.7.3 (anaconda install)
conda --version
conda 4.7.10

windows 10 ver 1803 (up to date Sept 2019)

pip uninstall PyYAML

ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

I don't recall having any problems installing chatterbot approx 12 months ago, but do recall similar problems earlier this year.

pip install --ignore-installed PyYAML

this worked after you have done that pip install chatterbot

Momentarily gets fixed by installing from source:

pipenv install git+https://github.com/gunthercox/chatterbot-corpus.git#egg=chatterbot-corpus

I guess all that would be needed is a version bump and pypi release.

this worked for me Thq

Guys, Sorry but that don't works. Any solutions?

pipenv install git+https://github.com/gunthercox/chatterbot-corpus.git#egg=chatterbot-corpus
really worked.Try it guys

It really worked for me, thanq

I'm also facing the same issue please help

I just ignore the conflict and use the most recent pyyaml version. That works for my project.

If these 2 projects are meant to work with each other than they need to have a PyYAML version they both can use. Most people use a dependency manager (pipenv, poetry, etc) and this is an issue. Here is poetry's error when trying to install both chatterbot and chatterbot-corpus in the same project.

[SolverProblemError]
Because no versions of chatterbot-corpus match >1.2,<2.0
 and chatterbot-corpus (1.2.0) depends on PyYAML (>=3.12,<4.0), chatterbot-corpus (>=1.2,<2.0) requires PyYAML (>=3.12,<4.0).
And because chatterbot (1.1.0) depends on pyyaml (>=5.3,<5.4)
 and no versions of chatterbot match >1.1,<2.0, chatterbot-corpus (>=1.2,<2.0) is incompatible with chatterbot (>=1.1,<2.0).
So, because the-promoter depends on both chatterbot (^1.1) and chatterbot-corpus (^1.2), version solving failed.

Hi, I tried to install chatterbot_corpus and got below error
can somebody please help me to get chatterbot_corpus installed in my PC
2020-07-11_15-12-09

khdan commented

hi, what I did was following this instructions to install pyenv and pipenv, https://hackernoon.com/reaching-python-development-nirvana-bb5692adf30c once I got it all in place and with the right python --version I installed directly from the source. good luck

Are there any updates on this? Tried to install chatterbot_corpus with poetry and still getting error for pyyaml versions mistmatch.
Screenshot from 2020-12-16 13-06-08