Nikola "conf.py" error on build in CI
Nikola imports conf.py as a Python module at the start of every command. An import that fails (a missing optional dependency) or an invalid setting raises before any rendering, ending nikola build.
What this error means
nikola build fails reading conf.py with a Python traceback - a ModuleNotFoundError for an optional package, or an error about an unexpected setting value.
Traceback (most recent call last):
File "conf.py", line 12, in <module>
import webassets
ModuleNotFoundError: No module named 'webassets'Common causes
conf.py imports an uninstalled optional dependency
A feature enabled in conf.py needs an extra package (webassets, a markup compiler) that the CI environment did not install.
An invalid or removed setting
A setting whose value or name changed between Nikola versions raises when conf.py is imported.
How to fix it
Install the optional dependency
- Read the traceback for the missing module or bad setting.
- Add the package to requirements, or use the Nikola extras that include it.
- Re-run
nikola build.
pip install "Nikola[extras]"
nikola buildCorrect the setting for your Nikola version
Update or remove a renamed setting so conf.py imports cleanly.
# match settings to the installed Nikola version
COMPILERS = {"rest": ['.rst'], "markdown": ['.md']}How to prevent it
- Install Nikola with the extras your conf.py needs.
- Keep conf.py settings aligned with the installed version.
- Pin Nikola and its extras in requirements.