I was trying to install chatterbot which has a dependency on PyYAML=3.12. In my Ubuntu machine installed PyYAML version is
Try using the --ignore-installed
flag:
sudo -H pip3 install --ignore-installed PyYAML
This works because to upgrade a package, pip
first uninstalls the old version, then installs the new version. It is the uninstall step that fails for distutils packages. With the --ignore-installed
flag, the uninstall step is skipped and the new version is simply installed on top of the old one.
You can try this:
$pip install --ignore-installed PyYAML
conda remove PyYAML
pip install chatterbot
pip install chatterbot_corpus
In this way it sloved my error while I was trying from chatterbot import chatbot
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.
sudo rm -rf /usr/lib/python3/dist-packages/yaml
sudo rm -rf /usr/lib/python3/dist-packages/PyYAML-*
Removing folder from distutils works
I personnaly had PyYAML installed on anaconda, just executing 'conda remove PyYAML' and then executing my pip command worked.
I found in this Github issue that pip 10 no longer uninstalls distutils packages. So I downgraded to pip 8.1.1. And now it works.
If anybody, who are viewing this question, knows how to uninstall or upgrade distutils package with pip 10.0.0, please let me know here. :)
(If anybody needs)
And to downgrade pip, I used the following:
sudo -H pip3 install pip==8.1.1