-
Notifications
You must be signed in to change notification settings - Fork 556
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
Docker image : enable extensions #837
Comments
Do the plots render correctly when viewed in Jupyter Notebook? Or is it only in NBViewer where they are rendered incorrectly? This seems like it might be a Jupyter notebook or conda environment issue. Could you attach your |
Yes they render correctly in the Notebook (after installing the widgetsnbextensions). I do not see any |
If there were an You said "the Docker image" -- which Docker image? Could you include a link to it? Sorry about the confusion. And when you say "in the Notebook", do you mean running the Notebook from within the docker container? Or running the notebook elsewhere? |
I am using the nbviewer docker image which is built from this repository. I think the output of
|
OK, I found the Dockerfile here: https://hub.docker.com/r/jupyter/nbviewer/dockerfile I can't find the corresponding GitHub repo where you could make a Pull Request however. There isn't a widgetsnbextensions package in the main Anaconda channel seemingly, but there does seem to be a conda-forge one: https://anaconda.org/conda-forge/widgetsnbextension Looking at the current Dockerfile it seems like it's already downloading packages from conda-forge instead of defaults, which is good. Maybe this might work? Change:
to
Worst case scenario you could also remove the line
and run the container as root (as long as you're just running this on your personal computer and not deploying it publicly). I am not sure which of the configuration settings are making it impossible to run conda as a regular user -- I thought conda was supposed to work better when not running as root, or that running as root is discouraged? The webpage says the Dockerfile was updated already 12 days ago, so apparently someone has write access for it and is updating it, but I don't know who, or where (if anywhere) one could make a PR for such things. It doesn't seem like it's in this repository though. I know that's not helpful, I'm sorry. |
Oh I'm so sorry+dumb; here's the Dockerfile, it is in this repository: https://github.com/jupyter/nbviewer/blob/aa567da928dd022ce6a75b6c131a5ef3ff5c211a/Dockerfile Anyway try the change
and if it works, it might make sense to make a PR against this repo with the change to the Dockerfile. Bokeh is a fairly commonly used library, and it does appear as one of the suggested notebooks on the frontpage, so my personal opinion (I don't have write access to the repo FYI) is that it could make sense to better integrate the Docker image to produce notebooks created with Bokeh. |
I tried the above solution but it did not work, there is the output of some tests that may help : Listing extensionsCommand :
Same if I remove the If I add the
But I still do not see my interactive plots |
Do you not see the plots at all, or are they not interactive? Any Python code in the notebook won't be run, so if the plots require running Python code in order to be interactive, then it's impossible for them to be interactive with NBViewer, since it just converts outputs to HTML (and javascript embedded in HTML too I think). Are any of your plots in a notebook which is on GitHub? What happens when you copy-paste the URL of that GitHub notebook into It seems like some Bokeh plots should work: To clarify, when you say they render correctly in Jupyter Notebook, are you running Jupyter Notebook from within the container created by the NBViewer image? It should be possible to do |
Ok so I tried the following:
So at this point it seems clear that there is a problem on my Therefore I tried a second, simpler notebook with only a bokeh (interactive with JS) plot and this time I see it in the docker nbviewer ! A last test to be sure that I understand the problem correctly : I add interactive plots using jupyter interact widget in my Conclusion : as @krinsman says, interact widget probably requires to run some python code, thus it cannot work on nbviewer, still bokeh is only interacting with JS code, so Bokeh+JS interaction works which is enough for me. Thanks all for your help ! I will not remove my test repository so it can helps other people experiencing similar issues. I guess you can close the issue. |
@dbeniamine Regarding the See: https://nbformat.readthedocs.io/en/latest/ There are some places (I think JupyterLab but not Jupyter notebook? I don't remember to be honest) where opening an old notebook won't throw an error because it automatically converts the file into the newest JSON format. This would explain at least why creating a new, simpler notebook would work, since any new notebooks would be created with the most recent JSON format. Regarding why it doesn't work on GitHub -- GitHub scrubs out most/all Javascript in notebooks, and so isn't able to display things fully the way NBViewer can. So NBViewer being able to render notebooks like yours is very important, since it's one of the most noticeable ways in which NBViewer differentiates itself from GitHub's preview. These issues in ipywidgets might be related/helpful: But anyway NBViewer is supposed to work with widgets, at least with some help: Line 314 in f1c8cb1
It is good to hear at least that Bokeh seems to be working for you. I apologize that I'm not being more helpful -- I know and understand very little about Bokeh or IPyWidgets, to be perfectly honest. |
@krinsman : you found the issue ! If I save the widget state on jupyter notebook, then nbviewer shows them. Thanks a lot 👍 |
Is your feature request related to a problem? Please describe.
I am trying to use the dockerized version of
nbviewer
to present some private notebooks (localfiles). Some of them use the widget extension (bokeh
and/orinteract
) but the extension does not seem to work on the docker image : none of mybokeh
orinteract
plots are shown while "normal" matplolib plots appears normally.Describe the solution you'd like
Install and or setup the widget extension on the nbviewer docker image
Describe alternatives you've considered
I tryed running
jupyter nbextension enable --py widgetsnbextension
directly on the docker container but it does not work as I am running bash asnobody
. To run this command while building the image, I also had to installjupyter
viaconda
but it did not fix my problem ....The text was updated successfully, but these errors were encountered: