You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Symbolic link causes problems with images in output cells #49
During compilation I get many warnings like: /home/wiecki/working/projects/pymc/docs/source/notebooks/survival_analysis.ipynb:193: WARNING: image file not readable: notebooks/../_build/doctrees/nbsphinx/notebooks_survival_analysis_11_0.png
I have seen #9 which looks very related and installed from master to make sure #10 was included but those don't fix this issue.
Reacted by Joel Berkeley, Daniel Weindl and Jack Moody
I don't think #9 and #10 have anything to do with that.
The problem seems to be that when Sphinx reads the intermediate reST file, which contains image links in the form notebooks/../_build/doctrees/nbsphinx/*.png, it apparently doesn't follow the symlink back to the source directory but it applies the .. to the symlink-free original location on the file system (which would actually make sense if this were in a real reST file). Therefore, it doesn't find the intermediate directory where the image files are stored.
This will hopefully be solved with #36, but I'm afraid this won't happen very soon.
In the meantime I guess I'll have to make some kind of work-around, any ideas how to tackle this?
Correction: The intermediate reST file contains links like this: ../_build/doctrees/nbsphinx/*.png, but Sphinx somehow prepends the directory notebooks/, which contains the source file.
I guess it's actually the operating system that resolves the .. part.
It seemed to ultimately work in #9, what is different about my usecase? Would it help if I moved the NBs out of the subdirectory? The same problem persists locally.
The problem is the symbolic link. It should work if you actually move the files to a "real" subdirectory docs/source/notebooks/. If you want, you can then make a symbolic link in the other direction, back to the original place pymc3/examples/notebooks/.
changed the title [-]Symbolic link seems to cause problems with paths to images[/-][+]Symbolic link causes problems with images in output cells[/+]on May 24, 2016
Good to know that the work-around helps. I changed the title to mention that the problem occurs in output cells. There shouldn't be any problems with images in Markdown cells.
Sorry, I don't know how to solve this before #36. But I'm open to suggestions!
If you don't want to move the NB dir into the doc dir, you can do it the other way round, by moving conf.py to your main directory (and then use master_doc = 'doc/index'). Would this be less unwieldy?
The Makefile is optional and IMHO not necessary. But if you want to use the auto-generated Makefile as is, I guess you'll have to move it, too. But I don't think that's a good idea since people might think that's a Makefile for the whole program/library, not only for the docs.
You could of course create a custom Makefile and put it anywhere you want, or you could manually call sphinx-build every time, or create a simple shell script, or ...
The IMHO nicest solution would be to use BuildDoc in your setup.py, then you could generate the docs by simply running:
python3 setup.py build_sphinx
In this case, you wouldn't even need to move your conf.py, since you could specify its location in setup.py.
If you want to go that way and need more information, don't hesitate to ask.
The problem is that build/sphinx directory where the compiled docs get stored does not contain index.html and the other master level files in the root directory but build/sphinx/html/docs/source. Any idea on how to fix that?
Activity
springcoil commentedon May 23, 2016
No idea how to debug that - do you want to merge WIP already or wait for the fix?
mgeier commentedon May 23, 2016
I don't think #9 and #10 have anything to do with that.
The problem seems to be that when Sphinx reads the intermediate reST file, which contains image links in the form
notebooks/../_build/doctrees/nbsphinx/*.png, it apparently doesn't follow the symlink back to the source directory but it applies the..to the symlink-free original location on the file system (which would actually make sense if this were in a real reST file). Therefore, it doesn't find the intermediate directory where the image files are stored.This will hopefully be solved with #36, but I'm afraid this won't happen very soon.
In the meantime I guess I'll have to make some kind of work-around, any ideas how to tackle this?
mgeier commentedon May 23, 2016
Correction: The intermediate reST file contains links like this:
../_build/doctrees/nbsphinx/*.png, but Sphinx somehow prepends the directorynotebooks/, which contains the source file.I guess it's actually the operating system that resolves the
..part.mgeier commentedon May 23, 2016
Let me throw in a few random links:
https://unix.stackexchange.com/questions/83966/cp-somefile-copies-to-a-different-directory-after-cding-via-a-symbolic-link
http://superuser.com/questions/749750/how-to-maintain-parent-path-of-symlinked-folder
http://stackoverflow.com/questions/10456784/behavior-of-cd-bash-on-symbolic-links
twiecki commentedon May 23, 2016
It seemed to ultimately work in #9, what is different about my usecase? Would it help if I moved the NBs out of the subdirectory? The same problem persists locally.
mgeier commentedon May 23, 2016
The problem is the symbolic link. It should work if you actually move the files to a "real" subdirectory
docs/source/notebooks/. If you want, you can then make a symbolic link in the other direction, back to the original placepymc3/examples/notebooks/.twiecki commentedon May 23, 2016
Oh nice, that works. http://pymc-devs.github.io/pymc3/notebooks/stochastic_volatility.html. Thanks.
[-]matplotlib plots do not show up[/-][+]Symbolic link seems to cause problems with paths to images[/+][-]Symbolic link seems to cause problems with paths to images[/-][+]Symbolic link causes problems with images in output cells[/+]mgeier commentedon May 24, 2016
Good to know that the work-around helps. I changed the title to mention that the problem occurs in output cells. There shouldn't be any problems with images in Markdown cells.
twiecki commentedon Jul 15, 2016
Any solution to this? Having the NB directory live in the doc subdir is a bit unwieldy.
mgeier commentedon Jul 16, 2016
Sorry, I don't know how to solve this before #36. But I'm open to suggestions!
If you don't want to move the NB dir into the doc dir, you can do it the other way round, by moving
conf.pyto your main directory (and then usemaster_doc = 'doc/index'). Would this be less unwieldy?twiecki commentedon Jul 16, 2016
Thanks for the suggestion.
conf.pyas well asMakefile, right?mgeier commentedon Jul 16, 2016
The
Makefileis optional and IMHO not necessary. But if you want to use the auto-generatedMakefileas is, I guess you'll have to move it, too. But I don't think that's a good idea since people might think that's aMakefilefor the whole program/library, not only for the docs.You could of course create a custom
Makefileand put it anywhere you want, or you could manually callsphinx-buildevery time, or create a simple shell script, or ...The IMHO nicest solution would be to use BuildDoc in your
setup.py, then you could generate the docs by simply running:In this case, you wouldn't even need to move your
conf.py, since you could specify its location insetup.py.If you want to go that way and need more information, don't hesitate to ask.
twiecki commentedon Jul 18, 2016
Thanks @mgeier. I think I'm making some progress: pymc-devs/pymc#1245
The problem is that
build/sphinxdirectory where the compiled docs get stored does not containindex.htmland the other master level files in the root directory butbuild/sphinx/html/docs/source. Any idea on how to fix that?mgeier commentedon Jul 19, 2016
I didn't think about this before, but I guess it makes sense that the output directory is laid out like this (mirroring the source directory).
You could try to move
index.rstto the main directory, too, but at some point it will get crowded ...To get nicer URLs for the other pages, you should probably get rid of the
sources/subdirectory.johannes-mueller commentedon Nov 7, 2019
It works for me when I create a real directory
notebooks/in thesources/subdirectory and in there have symlinks to the individual notebooks.I think that's a feasible workaround.
valeriupredoi commentedon Mar 13, 2025
cheers muchly, mate! This issue still bites, but your suggestion works perfectly fine 🍺