How to Install click in Python
Composable command line interface toolkit
pip install click
What is click?
Composable command line interface toolkit
Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It's the "Command Line Interface Creation Kit". It's highly configurable but comes with sensible defaults out of the box.
It aims to make the process of writing command line tools quick and fun while also preventing any frustration caused by the inability to implement an intended CLI API.
- Arbitrary nesting of commands - Automatic help page generation - Supports lazy loading of subcommands at runtime
Quick Start
Minimal example to get started with click:
import click
@click.command()
@click.option("--name", default="World", help="Who to greet")
def hello(name):
click.echo(f"Hello, {name}!")
if __name__ == "__main__":
hello()
# Usage: python script.py --name Alice
Installation
pip (standard)
pip install click
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install click
pip3
pip3 install click
conda
conda install -c conda-forge click
Poetry
poetry add click
Dependencies
Installing click will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import click; print(click.__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 click with pip.
ModuleNotFoundError: No module named 'click'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install click. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'click' (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 click to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'click'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show click and upgrade with pip install --upgrade click.
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 click. 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 click
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 click
Runtime Errors
Common errors when using click after installation.
click.exceptions.UsageError: Missing argument
Cause: A required argument was not provided on the command line.
Fix: Pass the argument or add required=False with a default value.
click.exceptions.BadParameter
Cause: A parameter value failed type conversion or custom validation.
Fix: Check the expected type. Use type=click.INT, click.FLOAT, etc. for automatic conversion.
Recent Releases
| Version | Released |
|---|---|
8.3.2 latest |
2026-04-03 |
8.3.1 |
2025-11-15 |
8.3.0 |
2025-09-18 |
8.2.2 |
2025-08-02 |
8.2.1 |
2025-05-20 |
Manage click
Upgrade to latest version
pip install --upgrade click
Install a specific version
pip install click==8.3.2
Uninstall
pip uninstall click
Check what is installed
pip show click