Last modified: Jun 23, 2025 By Alexander Williams

How to Uninstall Openpyxl in Python

Openpyxl is a popular Python library for working with Excel files. Sometimes, you may need to uninstall it. This guide will show you how.

Why Uninstall Openpyxl?

You might need to uninstall Openpyxl for several reasons. Maybe you want to switch to another library. Or perhaps you need a different version.

Uninstalling unused packages keeps your Python environment clean. It also helps avoid conflicts with other libraries.

Check if Openpyxl is Installed

Before uninstalling, check if Openpyxl is installed. Use the pip list command.


pip list

Look for Openpyxl in the output. If it's there, you can proceed with uninstallation.

Uninstall Openpyxl Using Pip

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


pip uninstall openpyxl

You will see a confirmation prompt. Type y and press Enter to confirm.

Verify Uninstallation

After uninstalling, verify Openpyxl is removed. Use pip list again.


pip list

Openpyxl should no longer appear in the list. If it does, try uninstalling again.

Uninstall Openpyxl in a Virtual Environment

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


source venv/bin/activate  # Linux/Mac
venv\Scripts\activate     # Windows
pip uninstall openpyxl

This ensures you remove Openpyxl only from the virtual environment.

Force Uninstall Openpyxl

Sometimes, uninstallation fails due to dependencies. Use the --force flag to force uninstall.


pip uninstall openpyxl --force

This removes Openpyxl even if other packages depend on it. Use with caution.

Reinstall Openpyxl if Needed

If you uninstalled Openpyxl by mistake, reinstall it easily. Use pip install.


pip install openpyxl

This will install the latest version of Openpyxl.

Common Issues and Fixes

If you encounter permission errors, try adding --user to the command.


pip uninstall openpyxl --user

For more complex issues, check out our guide on how to uninstall Pylint in Python.

Alternative Methods

You can also uninstall Openpyxl using a requirements file. First, remove it from the file. Then run:


pip install -r requirements.txt

This method is useful for managing multiple packages. Learn more in our guide on how to uninstall Pytest in Python.

Conclusion

Uninstalling Openpyxl is simple with pip. Use pip uninstall openpyxl and confirm the action. Always verify the uninstallation was successful.

For other Python uninstallation guides, check out how to uninstall IPython in Python.