Last modified: Jun 18, 2025 By Alexander Williams

How to Uninstall scikit-learn in Python

Scikit-learn is a popular Python library for machine learning. Sometimes, you may need to uninstall it. This guide will show you how.

Why Uninstall scikit-learn?

You might need to uninstall scikit-learn for several reasons. Maybe you want to install a different version. Or you need to free up space.

Another reason could be fixing installation errors. Sometimes a clean reinstall solves problems.

Check if scikit-learn is Installed

First, verify if scikit-learn is installed. Use the pip show command in your terminal.

 
pip show scikit-learn


Name: scikit-learn
Version: 1.0.2
Summary: A set of python modules for machine learning
...

If installed, you'll see package details. If not, you'll get a "not found" message.

Uninstall scikit-learn Using pip

The easiest way to uninstall is using pip uninstall. Run this command:

 
pip uninstall scikit-learn

You'll see a confirmation prompt. Type y and press Enter to proceed.


Uninstalling scikit-learn-1.0.2:
  Would remove ...
Proceed (y/n)? y
  Successfully uninstalled scikit-learn-1.0.2

Verify Uninstallation

After uninstalling, check if it's removed. Use the pip show command again.

 
pip show scikit-learn


WARNING: Package(s) not found: scikit-learn

This confirms scikit-learn is no longer installed.

Uninstall in Virtual Environment

If using a virtual environment, activate it first. Then run the uninstall command.


source venv/bin/activate  # Linux/Mac
pip uninstall scikit-learn

Reinstall scikit-learn

To install it again, use pip install. You can specify a version if needed.


pip install scikit-learn

Troubleshooting

If you face issues, try these steps:

1. Use pip3 instead of pip for Python 3.

2. Add --user flag if you get permission errors.

3. For complete removal, delete residual files manually.

Need to uninstall other Python libraries? Check these guides:

Uninstall NumPy

Uninstall Pandas

Uninstall Matplotlib

Conclusion

Uninstalling scikit-learn is simple with pip uninstall. Always verify the removal. This process works for most Python libraries.

Remember to check dependencies if you plan to reinstall. Happy coding!