pip-licenses-cli
raw JSON → 4.0.0 verified Fri May 01 auth: no python
A CLI tool to dump the software license list of Python packages installed with pip. Current version 4.0.0 requires Python >=3.10 and <4. It is a fork of pip-licenses with improved modularization and support for PEP 639 License-File field.
pip install pip-licenses-cli Common errors
error Command 'pip-licenses-cli' not found ↓
cause The package is not installed in the current environment.
fix
Run 'pip install pip-licenses-cli'.
error ModuleNotFoundError: No module named 'pip_licenses_cli' ↓
cause Trying to import the package directly instead of running it as a CLI tool.
fix
Do not import pip_licenses_cli as a Python module; use 'pip-licenses-cli' as a command-line tool.
Warnings
breaking Version 4.0.0 changes behavior for packages with UNKNOWN license: they are now omitted from plain-vertical output and result in empty lists in JSON output, whereas previously they were included as UNKNOWN. This may break scripts relying on the old behavior. ↓
fix Update parsing logic to handle missing license entries. To restore old behavior, open an issue to request a flag.
breaking Version 3.0.0 drops support for Python 3.9. Ensure your Python version is >=3.10. ↓
fix Upgrade Python to 3.10 or later.
deprecated The --with-license-file flag combined with --no-license-path is the recommended way to include inline license texts. Using --with-license-file alone will print file paths instead. ↓
fix Add --no-license-path if you want the license text inline.
gotcha Configuration from pyproject.toml is read from the [tool.pip-licenses-cli] section (not [tool.pip-licenses]). Using the wrong section name will silently ignore your config. ↓
fix Use [tool.pip-licenses-cli] in pyproject.toml.
gotcha The --ignore-packages flag requires full package names (e.g., 'requests') not versioned or partial names. ↓
fix Specify exact package names separated by commas.
Install
pip install pip-licenses-cli[spdx] Quickstart
import subprocess
result = subprocess.run(['pip-licenses-cli', '--format=json', '--with-license-file', '--no-license-path'], capture_output=True, text=True)
print(result.stdout)