-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Plotly plots rendered by nbsphinx not showing in sphinx_rtd_theme #788
Comments
Commenting out this line brings Plotly back to life:
And, looking at
Notice that Plotly needs Therefore I tried something crazy:
And now everything works like a charm. |
Workaround readthedocs#788.
Using Google Chrome, one thing that I found is that Both themes load the same version of I'm not sure, but I think what it's overlapping here is And... it seems to be a known issue: https://stackoverflow.com/a/25586213. They say that the solution could be to use There are more context about this on a issue on Browserify repo: browserify/browserify#790 It seems this is a potential good reason about why this is failing on Read the Docs Sphinx (BTW, alabaster does not include any JS at all). |
This is a good issue to revisit after #771 is merged which moves our build process to webpack, without browserify |
Hi, we are also trying to use |
If anything, probably this issue is not blocked anymore? |
Hi all, is there any update on this? pypi has not been updated since last year, and if I clone the master branch and use this, it still exhibits the same issue. Thank you :)! |
Hi, it's a pity this hasn't been fixed yet. What works for me is a variant of plotly/plotly.py#1033 (comment)
I add this in my notebooks through a raw html include file directive. This is easier to do by adding this to your sphinx conf.py: nbsphinx_prolog = r"""
.. raw:: html
<script src='http://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js'></script>
<script>require=requirejs;</script>
""" Note that if your notebooks use plotly.graph_objects.FigureWidget instead of Figure, this bug is not an issue. |
Is there any progress on this issue? |
Thank you so much @ociule, after quite a lot of struggle, your workaround works like charm! <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script> <script>require=requirejs;</script> For others who might be confused about how to insert this in a specific notebook (like I was), use |
Hi all! Its Jorge, from the poliastro dev team (working with @astrojuanlu). I saved a plotly figure in .. raw:: html
:file: path/to/file.html However, once documentation is built, it only shows a white space were the figure should be displayed. I found that the following error was raised when inspecting that web element:
I am not an expert on Javascript or web development. After a little search on the web, found the following exaplantion, see here:
If adding Maybe people with more experience on Javascript could have a better understanding about what is going on with this. Just posted this so it might be helpful 😅 |
Notice that my original issue uses nbsphinx (which I failed to mention in the description of this issue, I will change that accordingly) so @jorgepiloto case might be slightly different. |
I just tested |
🎉 |
This indeed solved the issue of showing the plotly figures and everthing works ! However, it's quite weired that it still complains about missing plotly.js . |
Attempt to fix plotly again as proposed in readthedocs/sphinx_rtd_theme#788 (comment)
Attempts
Errorsfirefox: require.min.js error which you can get past by installing 0.5.0rc1, or setting
Dependencies
plotly 4.14.3
|
Solved (locally)Okay so this in conf.py gets me past the initial
But then I get a new error that feels more specific to plotly.
So copy the contents of https://cdn.plot.ly/plotly-latest.min.js (4.2 MB on disk) and save it as plotly.js in that Bah but then this gets blocked on RTD
|
This one follows this suggestion: readthedocs/sphinx_rtd_theme#788 (comment)
Although this is a closed issue, it still popups, as require.js is somewhat difficult to work with. We had this is issue for both
Example html_js_files = [
"require.min.js", # Add to your _static
"custom.js",
] Example custom.js: requirejs.config({
paths: {
base: '/static/base',
plotly: 'https://cdn.plot.ly/plotly-2.12.1.min.js?noext',
},
}); This way
|
Hi... sorry I'm the Plotly guy again 🙏 You may remember me from such issues as readthedocs/readthedocs.org#4367 #328 and others.
Problem
Plotly plots rendered by nbsphinx show (both locally and remotely) when using Alabaster just fine, but they don't show at all when using sphinx_rtd_theme.
Reproducible Project
Error Logs/Results
Interestingly, the web developer console shows nothing with Alabaster, but with rtd_sphinx_theme shows a bunch of errors:
Expected Results
Plots should show regardless of the theme.
Environment Info
The text was updated successfully, but these errors were encountered: