How to Install h11 in Python
A pure-Python, bring-your-own-I/O implementation of HTTP/1.1
pip install h11
What is h11?
A pure-Python, bring-your-own-I/O implementation of HTTP/1.1
This is a little HTTP/1.1 library written from scratch in Python, heavily inspired by .
It's a "bring-your-own-I/O" library; h11 contains no IO code whatsoever. This means you can hook h11 up to your favorite network API, and that could be anything you want: synchronous, threaded, asynchronous, or your own implementation of `RFC 6214 ` -- h11 won't judge you. (Compare this to the current state of the art, where every time a `new network API ` comes along then someone gets to start over reimplementing the entire HTTP protocol from scratch.) Cory Benfield made an `excellent blog post describing the benefits of this approach `, or if you like video then here's his `PyCon 2016 talk on the same theme `.
This also means that h11 is not immediately useful out of the box: it's a toolkit for building programs that speak HTTP, not something that could directly replace `` or whatever. But h11 makes it much easier to implement something like ``.
Quick Start
Minimal example to get started with h11:
import h11
print(h11.__version__)
Installation
pip (standard)
pip install h11
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install h11
pip3
pip3 install h11
conda
conda install -c conda-forge h11
Poetry
poetry add h11
Verify the Installation
After installing, confirm the package is available:
python -c "import h11; print(h11.__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 h11 with pip.
ModuleNotFoundError: No module named 'h11'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install h11. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'h11' (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 h11 to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'h11'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show h11 and upgrade with pip install --upgrade h11.
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 h11. 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 h11
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 h11
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 |
|---|---|
0.15.0 |
2025-04-24 |
0.16.0 latest |
2025-04-24 |
0.14.0 |
2022-09-25 |
0.13.0 |
2022-01-19 |
0.12.0 |
2021-01-01 |
Manage h11
Upgrade to latest version
pip install --upgrade h11
Install a specific version
pip install h11==0.16.0
Uninstall
pip uninstall h11
Check what is installed
pip show h11