How to Install xlwt in Python
Library to create spreadsheet files compatible with MS Excel 97/2000/XP/2003 XLS files, on any platform, with Python 2.6, 2.7, 3.3+
pip install xlwt
What is xlwt?
Library to create spreadsheet files compatible with MS Excel 97/2000/XP/2003 XLS files, on any platform, with Python 2.6, 2.7, 3.3+
This is a library for developers to use to generate spreadsheet files compatible with Microsoft Excel versions 95 to 2003.
The package itself is pure Python with no dependencies on modules or packages outside the standard Python distribution.
Please read this before using this package:
Quick Start
Minimal example to get started with xlwt:
import xlwt
print(xlwt.__version__)
Installation
pip (standard)
pip install xlwt
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install xlwt
pip3
pip3 install xlwt
conda
conda install -c conda-forge xlwt
Poetry
poetry add xlwt
Verify the Installation
After installing, confirm the package is available:
python -c "import xlwt; print(xlwt.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing xlwt with pip.
ModuleNotFoundError: No module named 'xlwt'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install xlwt. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'xlwt' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install xlwt to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'xlwt'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show xlwt and upgrade with pip install --upgrade xlwt.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install xlwt. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user xlwt
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org xlwt
ConnectionError: Failed to establish a new connection
Cause: Server unreachable, URL invalid, or firewall/proxy blocking the connection.
Fix: Verify the URL and network access. Set HTTP_PROXY / HTTPS_PROXY env vars if behind a proxy.
SSLError: CERTIFICATE_VERIFY_FAILED
Cause: The remote server's SSL certificate cannot be verified.
Fix: Update CA certificates on your system. For testing only, disable SSL verification (never in production).
Recent Releases
| Version | Released |
|---|---|
1.3.0 latest |
2017-08-22 |
1.2.0 |
2017-01-04 |
1.1.2 |
2016-06-09 |
1.1.1 |
2016-06-02 |
1.0.0 |
2015-04-15 |
Manage xlwt
Upgrade to latest version
pip install --upgrade xlwt
Install a specific version
pip install xlwt==1.3.0
Uninstall
pip uninstall xlwt
Check what is installed
pip show xlwt