Last modified: Jun 23, 2025 By Alexander Williams
How to Uninstall Black in Python
Black is a popular Python code formatter. Sometimes, you may need to uninstall it. This guide explains how to remove Black cleanly.
Table Of Contents
What Is Black?
Black is an opinionated Python code formatter. It automatically formats your code to follow PEP 8 guidelines. It's widely used in Python projects.
Why Uninstall Black?
You might want to uninstall Black for several reasons. Maybe you're switching to another formatter. Or perhaps you need to free up space. Whatever the reason, uninstalling is simple.
Check If Black Is Installed
Before uninstalling, check if Black is installed. Use the pip show
command in your terminal.
pip show black
If Black is installed, you'll see package details. If not, you'll get a "not found" message.
Uninstall Black Using Pip
The easiest way to uninstall Black is with pip. Run this command in your terminal.
pip uninstall black
You'll see a confirmation prompt. Type y and press Enter to proceed. Pip will remove Black and its dependencies.
Verify Uninstallation
After uninstalling, verify Black is removed. Run the pip show
command again.
pip show black
You should now see a "Package(s) not found" message. This confirms Black is uninstalled.
Uninstall Black in Virtual Environment
If you installed Black in a virtual environment, activate it first. Then run the uninstall command.
source venv/bin/activate # For Linux/Mac
pip uninstall black
For Windows, use this activation command instead.
venv\Scripts\activate
pip uninstall black
Troubleshooting
Sometimes, uninstallation may fail. Here are common fixes.
Permission Errors
If you get permission errors, try adding --user
flag.
pip uninstall black --user
Multiple Python Versions
For systems with multiple Python versions, specify the correct pip.
pip3 uninstall black # For Python 3
Alternative Removal Methods
If pip uninstall fails, try these methods.
Manual Removal
Find Black's installation location and delete it manually.
pip show black | grep Location
Navigate to the shown directory and remove Black files.
Using Python
You can also uninstall from Python directly.
import pip
pip.main(['uninstall', 'black', '-y'])
Related Uninstall Guides
Need to uninstall other Python packages? Check these guides:
- How to Uninstall Pytest in Python
- How to Uninstall IPython in Python
- How to Uninstall Jupyter Notebook
Conclusion
Uninstalling Black is straightforward with pip. Use pip uninstall black
and confirm removal. For issues, try alternative methods or check permissions. Now you know how to cleanly remove Black from your Python environment.