Skip to content

[Solved] 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.

Problem

Today when I installed pytorch-lightning package in the Kaggle virtual environment, I got the following error message:

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.


The problem is a python module: PyYAML. I think it is the dependency package of pytorch-lightning. According to the error message, it should be installed by distutils, so the removal process cannot confirm which files belong to it, so just be partially uninstalled.


Solution

This is a problem that many people have encountered. The most commonly seen solution is to upgrade the package the parameter --ignore-installed.

The usual update procedure is to delete the old version and then reinstall the new version, but now the problem is that we cannot identify which files belong to the old version package and need to be deleted.

After adding this parameter, we can skip the deletion process and overwrite the old version. The only problem is that there may be old version files that become system junk

The full instruction should be:

pip3 install --ignore-installed PyYAML

References


Read More

Tags:

Leave a Reply