How to Install invoke in Python
Pythonic task execution
pip install invoke
What is invoke?
Pythonic task execution
Invoke is a Python library for managing shell-oriented subprocesses and organizing executable Python code into CLI-invokable tasks. It draws inspiration from various sources (``, Fabric 1.x, etc) to arrive at a powerful & clean feature set.
To find out what's new in this version of Invoke, please see `the changelog `.
For a high level introduction, including example code, please see `our main project website the versioned API website `.
Quick Start
Minimal example to get started with invoke:
from invoke import task
@task
def build(c):
c.run("python -m build")
@task
def test(c):
c.run("pytest tests/")
@task(pre=[build])
def deploy(c):
c.run("scp dist/*.whl server:/opt/app/")
# Run: invoke test
Installation
pip (standard)
pip install invoke
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install invoke
pip3
pip3 install invoke
conda
conda install -c conda-forge invoke
Poetry
poetry add invoke
Verify the Installation
After installing, confirm the package is available:
python -c "import invoke; print(invoke.__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 invoke with pip.
ModuleNotFoundError: No module named 'invoke'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install invoke. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'invoke' (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 invoke to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'invoke'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show invoke and upgrade with pip install --upgrade invoke.
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 invoke. 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 invoke
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 invoke
Recent Releases
| Version | Released |
|---|---|
3.0.3 latest |
2026-04-07 |
3.0.1 |
2026-04-06 |
3.0.2 |
2026-04-06 |
3.0.0 |
2026-04-05 |
2.1.4 |
2025-10-11 |
Manage invoke
Upgrade to latest version
pip install --upgrade invoke
Install a specific version
pip install invoke==3.0.3
Uninstall
pip uninstall invoke
Check what is installed
pip show invoke