Fix Cannot uninstall ‘PyYAML’. It is a distutils installed project When Using Pip Install – Python Tutorial

By | November 30, 2021

When we are using pip install command to install python packages, we may get this 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. In this tutorial, we will introduce how to fix this error.

This error looks like:

Fix Cannot uninstall 'PyYAML'. It is a distutils installed project When Using Pip Install - Python Tutorial

You may plan to use pip uninstall command to uninstall PyYAML, however, you will fail to fix this problem.

pip uninstall PyYAML

How to fix this problem?

Because PyYAML is not installed by pip, we can not uninstall it using pip uninstall.

We can ignore it when using pip install. For example:

pip install asteroid --ignore-installed PyYAML

We can use –ignore-installed argument when using pip install.

Then we can find this error is disappeared.