Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade disutils package PyYAML?

Tags:

pip

pyyaml

I was trying to install chatterbot which has a dependency on PyYAML=3.12. In my Ubuntu machine installed PyYAML version is 3.11. So I used the following command to upgrade PyYAML:

sudo -H pip3 install --upgrade PyYAML

But it gives the following 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.

My pip3 version is 10.0.0.

How to resolve this?

like image 815
sphoenix Avatar asked Apr 19 '18 01:04

sphoenix


People also ask

Can not 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.

How do I know if Pyyaml is installed?

To check which version of pyyaml is installed, use pip show pyyaml or pip3 show pyyaml in your CMD/Powershell (Windows), or terminal (macOS/Linux/Ubuntu) to obtain the output major.


2 Answers

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.

like image 159
Fenhl Avatar answered Oct 21 '22 20:10

Fenhl


You can try this:

$pip install --ignore-installed PyYAML 
like image 28
mehboob sayyed Avatar answered Oct 21 '22 19:10

mehboob sayyed