MyST-NB icon indicating copy to clipboard operation
MyST-NB copied to clipboard

LaTeX build failure, looking for generated images in incorrect location

Open rossbar opened this issue 2 years ago • 1 comments

Describe the problem

The sphinx latexpdf builder is failing due to an inability to find .png files that are generated when executing notebooks.

Here's the last line prior to failure from the latex .log file:

./networkx_reference.tex:90523: Unable to load picture or PDF file 'build/jupyt 
er_execute/reference/tutorial_82_0.png'.                                        
<to be read again>                                                              
                   }

Which seems to indicate that the latex builder is looking for the tutorial_82_0.png image in the jupyter_execute/reference directory. However, the tutorial_82_0.png file does exist one directory up (i.e. jupyter_execute/tutorial_82_0.png). Note also that the tutorial.md that is being executed to generate these images lives in the top-level directory, not in the reference/ subdirectory:

$ tree -L 1
.
├── auto_examples
├── build
├── conf.py
├── developer
├── index.rst
├── install.rst
├── Makefile
├── modules
├── README.md
├── reference
├── release
├── _static
├── _templates
└── tutorial.md

Link to your repository or website

https://github.com/networkx/networkx/pull/5221

Steps to reproduce

git clone https://github.com/rossbar/networkx.git
cd networkx
git checkout --track origin/mystnb-doc
python -m venv nx-dev
source nx-dev/bin/activate
python -m pip install -r requirements/default.txt -r requirements/doc.txt -r requirements/extra.txt -r requirements/example.txt
python -m pip install -e .
make -C doc/ latexpdf LATEXOPTS="-file-line-error -halt-on-error"

The version of Python you're using

3.9.9

Your operating system

Linux 5.15.6-arch2-1

Versions of your packages

Output of pip list:

Package                       Version     Location
----------------------------- ----------- -------------------
affine                        2.3.0
alabaster                     0.7.12
anyio                         3.4.0
argon2-cffi                   21.1.0
attrs                         21.2.0
Babel                         2.9.1
backcall                      0.2.0
beautifulsoup4                4.10.0
bleach                        4.1.0
cairocffi                     1.3.0
certifi                       2021.10.8
cffi                          1.15.0
charset-normalizer            2.0.9
click                         8.0.3
click-plugins                 1.1.1
cligj                         0.7.2
colorama                      0.4.4
contextily                    1.2.0
cycler                        0.11.0
debugpy                       1.5.1
decorator                     5.1.0
defusedxml                    0.7.1
docutils                      0.17.1
entrypoints                   0.3
Fiona                         1.8.20
fonttools                     4.28.3
geographiclib                 1.52
geopandas                     0.10.2
geopy                         2.2.0
gitdb                         4.0.9
GitPython                     3.1.24
greenlet                      1.1.2
idna                          3.3
igraph                        0.9.8
imagesize                     1.3.0
importlib-metadata            4.8.2
ipykernel                     6.6.0
ipython                       7.30.1
ipython-genutils              0.2.0
ipywidgets                    7.6.5
jedi                          0.18.1
Jinja2                        3.0.3
joblib                        1.1.0
jsonschema                    4.2.1
jupyter-cache                 0.4.3
jupyter-client                7.1.0
jupyter-core                  4.9.1
jupyter-server                1.13.0
jupyter-server-mathjax        0.2.3
jupyter-sphinx                0.3.2
jupyterlab-pygments           0.1.2
jupyterlab-widgets            1.0.2
kiwisolver                    1.3.2
libpysal                      4.5.1
lxml                          4.6.4
markdown-it-py                1.1.0
MarkupSafe                    2.0.1
matplotlib                    3.5.0
matplotlib-inline             0.1.3
mdit-py-plugins               0.2.8
mercantile                    1.2.1
mistune                       0.8.4
momepy                        0.5.1
munch                         2.5.0
myst-nb                       0.13.1
myst-parser                   0.15.2
nbclient                      0.5.9
nbconvert                     6.3.0
nbdime                        3.1.1
nbformat                      5.1.3
nest-asyncio                  1.5.4
networkx                      2.7rc1.dev0 /home/ross/networkx
notebook                      6.4.6
numpy                         1.21.4
numpydoc                      1.1.0
osmnx                         1.1.2
packaging                     21.3
pandas                        1.3.4
pandocfilters                 1.5.0
parso                         0.8.3
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        8.4.0
pip                           21.2.4
prometheus-client             0.12.0
prompt-toolkit                3.0.23
ptyprocess                    0.7.0
pycparser                     2.21
pydata-sphinx-theme           0.7.2
pydot                         1.4.2
pygeos                        0.12.0
Pygments                      2.10.0
pygraphviz                    1.7
pyparsing                     3.0.6
pyproj                        3.3.0
pyrsistent                    0.18.0
python-dateutil               2.8.2
python-igraph                 0.9.8
pytz                          2021.3
PyYAML                        6.0
pyzmq                         22.3.0
rasterio                      1.2.10
requests                      2.26.0
Rtree                         0.9.7
scipy                         1.7.3
seaborn                       0.11.2
Send2Trash                    1.8.0
setuptools                    58.1.0
setuptools-scm                6.3.2
Shapely                       1.8.0
six                           1.16.0
smmap                         5.0.0
sniffio                       1.2.0
snowballstemmer               2.2.0
snuggs                        1.4.7
soupsieve                     2.3.1
Sphinx                        4.3.1
sphinx-gallery                0.10.1
sphinx-togglebutton           0.2.3
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
SQLAlchemy                    1.4.27
terminado                     0.12.1
testpath                      0.5.0
texext                        0.6.6
texttable                     1.6.4
tomli                         1.2.2
tornado                       6.1
tqdm                          4.62.3
traitlets                     5.1.1
typing_extensions             4.0.1
urllib3                       1.26.7
wcwidth                       0.2.5
webencodings                  0.5.1
websocket-client              1.2.3
wheel                         0.37.0
widgetsnbextension            3.5.2
xyzservices                   2021.11.0
zipp                          3.6.0

Additional context

  • There are no corresponding problems with the html builder
  • I've also tried this in an environment with jupyterbook-latex installed - this had no effect.

rossbar avatar Dec 07 '21 21:12 rossbar

Note this may now be fixed with #380: rendering of code outputs is now handled at a much earlier stage, meaning that we no longer have to do any "hacky" stuff to reverse-engineer how sphinx usually handles images

chrisjsewell avatar Apr 21 '22 08:04 chrisjsewell