Pelican "ModuleNotFoundError" for a plugin in CI
Pelican imports each plugin named in PLUGINS when it starts. A plugin that is referenced but not installed (or a renamed namespace plugin) raises ModuleNotFoundError before any content is generated.
What this error means
pelican fails on startup with "ModuleNotFoundError: No module named 'X'" where X is a configured plugin, ending the build.
pelican
ModuleNotFoundError: No module named 'pelican.plugins.sitemap'
(referenced in PLUGINS in pelicanconf.py)Common causes
The plugin package is not installed
PLUGINS lists a plugin whose package was never added to requirements, so a clean CI install does not have it.
A namespace plugin import path mismatch
Newer Pelican plugins live under pelican.plugins.*; an old or wrong import path no longer resolves.
How to fix it
Install the plugin and pin it
- Add the plugin distribution to requirements.
- Use the correct import name in PLUGINS.
- Reinstall and re-run pelican.
Terminal
pip install pelican-sitemap
# pelicanconf.py: PLUGINS = ['pelican.plugins.sitemap']Match the import path to the plugin version
Confirm whether the plugin uses a namespace path or a legacy PLUGIN_PATHS directory, and configure accordingly.
pelicanconf.py
PLUGINS = ['pelican.plugins.sitemap']How to prevent it
- Keep every configured plugin in requirements.
- Use the namespace import path the plugin version expects.
- Install from a pinned requirements file in CI.
Related guides
Pelican "Could not process" reStructuredText in CIFix Pelican "Could not process X.rst" in CI - a reStructuredText article has a directive or markup error that…
Nikola "conf.py" error on build in CIFix Nikola build failures from conf.py in CI - `nikola build` raises while importing the config, often from a…
Bridgetown "could not be built" Liquid error in CIFix Bridgetown "Liquid error" / page "could not be built" during `bridgetown deploy` in CI - a Liquid templat…