Skip to content
Latchkey

pip-licenses "fail-on" GPL blocks the build in CI

pip-licenses inspected the installed distributions in the environment and found a package whose license matches your --fail-on list (for example GPL), so it exited non-zero to stop CI.

What this error means

pip-licenses prints the license table and exits 1 with a message about a package matching --fail-on. It only reports packages actually installed in the active environment.

Terminal
fail-on license GPLv3 was found for package chardet:5.2.0
Error: fail-on license was detected.

Common causes

An installed package uses a banned license

A dependency in the current virtualenv reports a license (via its metadata) that is on your --fail-on list, so pip-licenses fails the run.

License is read from installed metadata only

pip-licenses reads the installed environment, so a package must be installed to be evaluated; a mismatched or dev-only install can change results.

How to fix it

Gate with an allow-only list

  1. List the tree with pip-licenses to see every license present.
  2. Prefer --allow-only so anything not permitted fails, not just named licenses.
  3. Replace or remove the offending package, then re-run.
Terminal
pip-licenses --allow-only="MIT;BSD License;Apache Software License;ISC License (ISCL)"

Use fail-on for an explicit deny list

When you must ban specific licenses, pass them semicolon separated to --fail-on and read the metadata name exactly as pip-licenses prints it.

Terminal
pip-licenses --fail-on="GNU General Public License v3 (GPLv3);GNU General Public License (GPL)"

How to prevent it

  • Run pip-licenses against the exact environment CI installs.
  • Match license strings to the metadata names pip-licenses reports, not SPDX ids.
  • Prefer an allow-only policy so new licenses fail closed.

Frequently asked questions

What causes "pip-licenses --fail-on"?
A dependency in the current virtualenv reports a license (via its metadata) that is on your --fail-on list, so pip-licenses fails the run.
How do I fix pip-licenses --fail-on?
Gate with an allow-only list

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card