How to Install anyio in Python
High-level concurrency and networking framework on top of asyncio or Trio
pip install anyio
What is anyio?
High-level concurrency and networking framework on top of asyncio or Trio
AnyIO is an asynchronous networking and concurrency library that works on top of either asyncio or Trio. It implements Trio-like (SC) on top of asyncio and works in harmony with the native SC of Trio itself.
Applications and libraries written against AnyIO's API will run unmodified on either asyncio or Trio. AnyIO can also be adopted into a library or application incrementally – bit by bit, no full refactoring necessary. It will blend in with the native libraries of your chosen backend.
To find out why you might want to use AnyIO's APIs instead of asyncio's, you can read about it .
Quick Start
Minimal example to get started with anyio:
import anyio
print(anyio.__version__)
Installation
pip (standard)
pip install anyio
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install anyio
pip3
pip3 install anyio
conda
conda install -c conda-forge anyio
Poetry
poetry add anyio
Dependencies
Installing anyio will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import anyio; print(anyio.__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 anyio with pip.
ModuleNotFoundError: No module named 'anyio'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install anyio. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'anyio' (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 anyio to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'anyio'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show anyio and upgrade with pip install --upgrade anyio.
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 anyio. 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 anyio
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 anyio
Recent Releases
| Version | Released |
|---|---|
4.13.0 latest |
2026-03-24 |
4.12.1 |
2026-01-06 |
4.12.0 |
2025-11-28 |
4.11.0 |
2025-09-23 |
4.10.0 |
2025-08-04 |
Manage anyio
Upgrade to latest version
pip install --upgrade anyio
Install a specific version
pip install anyio==4.13.0
Uninstall
pip uninstall anyio
Check what is installed
pip show anyio