Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geo_e4cv nbsphinx error: module 'jinja2.utils' has no attribute 'escape' #233

Closed
prjemian opened this issue Jun 22, 2022 · 8 comments · Fixed by #234
Closed

geo_e4cv nbsphinx error: module 'jinja2.utils' has no attribute 'escape' #233

prjemian opened this issue Jun 22, 2022 · 8 comments · Fixed by #234
Assignees
Labels
Milestone

Comments

@prjemian
Copy link
Contributor

Since switching to nbsphinx, the workflow that publishes documentation has failed (https://github.com/bluesky/hklpy/runs/6995106866?check_suite_focus=true, https://github.com/bluesky/hklpy/runs/6995279669?check_suite_focus=true) with this error:

Notebook error:
AttributeError in examples/notebooks/geo_e4cv.ipynb:
module 'jinja2.utils' has no attribute 'escape'
make[1]: *** [Makefile:60: html] Error 2
make[1]: Leaving directory '/home/runner/work/hklpy/hklpy/docs'
make: *** [Makefile:14: html] Error 2
Error: Process completed with exit code 2.

This error might not be limited to this one notebook. The workflow stops on the first error:

make -C docs html
make[1]: Entering directory '/home/runner/work/hklpy/hklpy/docs'
sphinx-build -b html -d build/doctrees   source build/html
Running Sphinx v4.4.0
making output directory... done
[autosummary] generating autosummary for: api.rst, calc.rst, context.rst, diffract.rst, engine.rst, examples/index.rst, examples/notebooks/geo_e4cv.ipynb, examples/notebooks/geo_e6c.ipynb, examples/notebooks/geo_k4cv.ipynb, examples/notebooks/how_additional_parameters.ipynb, ..., geometries.rst, geometry_tables.rst, index.rst, install.rst, overview.rst, ready_to_use.rst, release_notes.rst, sample.rst, user.rst, util.rst
loading intersphinx inventory from https://docs.python.org/3/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 28 source files that are out of date
updating environment: [new config] 28 added, 0 changed, 0 removed
reading sources... [  3%] api
reading sources... [  7%] calc
reading sources... [ 10%] context
reading sources... [ 14%] diffract
reading sources... [ 17%] engine
reading sources... [ 21%] examples/index
reading sources... [ 25%] examples/notebooks/geo_e4cv
Notebook error:
AttributeError in examples/notebooks/geo_e4cv.ipynb:
module 'jinja2.utils' has no attribute 'escape'
make[1]: *** [Makefile:60: html] Error 2
make[1]: Leaving directory '/home/runner/work/hklpy/hklpy/docs'
make: *** [Makefile:14: html] Error 2
Error: Process completed with exit code 2.
@prjemian prjemian added the bug label Jun 22, 2022
@prjemian prjemian added this to the v1.0.3 milestone Jun 22, 2022
@prjemian prjemian self-assigned this Jun 22, 2022
@prjemian
Copy link
Contributor Author

Is this due to Python version (3.8 is used)? Try Py3.9.

@prjemian
Copy link
Contributor Author

Aha! Swap the order of the channels here.

conda install jupyter nbconvert sphinx nbsphinx sphinxcontrib-napoleon make flake8 black pandoc -c defaults -c conda-forge

@prjemian
Copy link
Contributor Author

prjemian commented Jun 22, 2022

Trying to replicate, so far cannot reproduce locally:

micromamba create -y -n dev-hklpy python=3.8
micromamba install -y -n dev-hklpy -f environment.yml
micromamba install -y -n dev-hklpy jupyter nbconvert "sphinx=4.4.0" sphinx_rtd_theme nbsphinx sphinxcontrib-napoleon make flake8 black pandoc -c conda-forge -c defaults

eval "$(micromamba shell hook --shell=bash)"
micromamba activate dev-hklpy
pip install -e .
make -C docs clean html

@prjemian
Copy link
Contributor Author

Locally, no problem building with either Py 3.8 or 3.9. Need to get a list of the specific packages installed in the Actions workflow run.

Note Sphinx version 5.0.2 is available but the workflow installs 4.4.0. Curious, that.

@prjemian
Copy link
Contributor Author

Good time to switch the workflow to micromamba (#231).

@prjemian
Copy link
Contributor Author

I'm not convinced that module 'jinja2.utils' has no attribute 'escape' is the real problem here.

@prjemian
Copy link
Contributor Author

See: jupyter/nbconvert#1736
which means to compare the jinja2 version between workflow and local.

@prjemian
Copy link
Contributor Author

It's a miracle, with commit 11fa1ad (for #231), the documentation builds without error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant