How to Install starlette in Python
The little ASGI library that shines.
pip install starlette
What is starlette?
The little ASGI library that shines.
✨ The little ASGI framework that shines. ✨
Starlette is a lightweight [ASGI][asgi] framework/toolkit, which is ideal for building async web services in Python.
It is production-ready, and gives you the following:
Quick Start
Minimal example to get started with starlette:
import starlette
print(starlette.__version__)
Installation
pip (standard)
pip install starlette
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install starlette
pip3
pip3 install starlette
conda
conda install -c conda-forge starlette
Poetry
poetry add starlette
Dependencies
Installing starlette will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import starlette; print(starlette.__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 starlette with pip.
ModuleNotFoundError: No module named 'starlette'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install starlette. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'starlette' (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 starlette to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'starlette'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show starlette and upgrade with pip install --upgrade starlette.
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 starlette. 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 starlette
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 starlette
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.0.0 latest |
2026-03-22 |
1.0.0rc1 |
2026-02-23 |
0.52.0 |
2026-01-18 |
0.52.1 |
2026-01-18 |
0.51.0 |
2026-01-10 |
Manage starlette
Upgrade to latest version
pip install --upgrade starlette
Install a specific version
pip install starlette==1.0.0
Uninstall
pip uninstall starlette
Check what is installed
pip show starlette