Skip to content
Latchkey

setuptools "package ... would be ignored" build warning in CI

setuptools warns that a directory it found is not recognized as an importable package and "would be ignored", so it is left out of the wheel. The result is an installable but broken distribution that is missing modules at import time.

What this error means

The build prints "package init file ... not found (or not a regular file)" or that a package "would be ignored", and the resulting wheel is missing modules, causing ModuleNotFoundError after install.

setuptools
SetuptoolsDeprecationWarning: Installing 'mypkg.subpkg' as data is deprecated, please list it in `packages`.
    !!  'mypkg.subpkg' would be ignored.

Common causes

A subpackage has no __init__.py

setuptools treats a directory without __init__.py as data, not a package, so it is excluded unless you opt into namespace packages.

The package is not covered by find or packages

A directory outside the configured include/where discovery scope is silently dropped from the wheel.

How to fix it

Add __init__.py or widen discovery

  1. Add an __init__.py to each package directory.
  2. Confirm the discovery include/where covers it.
  3. Rebuild and verify the wheel contains every module.
pyproject.toml
[tool.setuptools.packages.find]
where = ["src"]
include = ["mypkg*"]

Inspect the wheel contents

List the wheel to confirm no package was dropped before publishing.

Terminal
python -m build --wheel
unzip -l dist/*.whl | grep mypkg/

How to prevent it

  • Keep an __init__.py in every package directory.
  • Verify wheel contents in CI, not just that the build exits 0.
  • Use explicit find configuration over implicit discovery.

Frequently asked questions

What causes ""package ... would be ignored""?
setuptools treats a directory without __init__.py as data, not a package, so it is excluded unless you opt into namespace packages.
How do I fix "package ... would be ignored"?
Add __init__.py or widen discovery

Related guides

References

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