Hello. I’m very new to Julia. I did dabble with it about 3 years ago, but only in the last week have I decided to work much more with it. I’m a very long time R user.
I have been working through the pluto.jl examples and find them very useful. I have also created some interactive notebooks of my own. However, whenever I export to static HTML, the files lose interactivity in the browser. e.g. sliders no longer are interactive - such as the slider at the bottom of the mathematics.jl file.
What I would ideally like to do is to host my custom notebooks on the web somewhere for my students to play around with. Is there an easy way of achieving this? and, should I have expected the sliders to have worked even in the static HTML export?
Pluto interactivity (and Jupyter interactivity, for that matter) requires interacting with a Julia process. So you’re correct that it doesn’t survive the conversion to static HTML.
Last I checked the status was the following: it’s possible with sufficient effort to host a Pluto notebook using a service like Heroku. It’s also part of the long-term roadmap to support a more convenient way to host your Pluto notebooks on the web. (Again, just recapping what I learned when I was asking this question.) You can see some discussion along these lines here. Grain of salt, though; this info might be out of date at this point.
Actually, I see it’s possible to set up Pluto on Binder; check it out here. I’m guessing that’s going to be your best option in the short term, though more knowledgeable people might weigh in on this thread with the latest info.
The simplest way is to put your notebook online somewhere (github, github gist, your university web page), and then use pluto-on-binder.glitch.me to generate a binder link for that notebook
I like using Jupyter notebooks because github parses them as an HTML document. So it’s great for me to share with others as a “report”. They may not be able to run/update the code (well, unless they checkout the code)… but it does show all the input and output cells.
Hi Fons!
Here a big fan of Pluto, but in a learning curve on Julia/Pluto.
I tried your pluto-on-binder.glitch.me with a very small Pluto notebook example from my GitHub to test notebook shared online. It works!
But, with a more complex (not so complex) Pluto notebook, it gives me an error when Pluto starts running. I think it may be Julia or Pluto versions on Binder, it gives this error when installing the packages:
Any idea? Please, take time on this issue only if it is simple to solve… because you should be kept on track on important Pluto things
Ricardo
Replace the contents of the notebooks folder with your notebooks (or maybe just delete it and leave your notebooks in a separate place, so that you can update the notebooks without triggering a rebuild of the binder docker image).
Modify the version of Julia in the Dockerfile if you want something other than 1.5.3
Modify the Project.toml and Manifest.toml files. Probably easiest to just delete them and then recreate them by running something like
using Pkg
Pkg.activate("path/to/repo") # modify this
Pkg.add(["Pluto","PlutoUI", "Plots", "Dierckx", "DataFrames", "DataInterpolations"]) #
Then push your changes, and point mybinder.org to your repository.
Compared to adding packages within a notebook, an advantage of this approach is that package installation and precompilation happens only when the docker the image for the repository is built (or rebuilt after each commit), instead of each time a user opens the notebook. It does, however, take quite some time to rebuild the docker image after the repository is updated.
Hi, I’ll try this out! It looks promising, even though I’m not sure I can do it. But, I will definitely try to follow your explanation.
Thank you in advance
@Paul_Schrimpf thanks for your instructions. Your setup looks nice, and faster and cleaner than the Heroku versions I’ve tried. I’ve almost got it working, but not quite. The Jupyter notebook browser shows up, but Pluto doesn’t launch. If you have a minute, would you take a quick look at my repository to help me identify what’s different about mine from yours?
I followed these steps, including adding Pluto and PlutoUI to the Project.toml file, but the Jupyter notebok browser shows up for me as well, not Pluto.
I then tried feeding your Github repo URL to binder (as well as that of @roualdes from the last post), but those don’t work either - I simply see the Jupyter notebooks. Can someone confirm if @Paul_Schrimpf’s method still works?
So it does, thank you for pointing it out! After starting Pluto.jl, the notebook URL inside the container (in this case /home/jovyan/notebooks/test.jl) has to be entered manually. Is there a way to start Pluto automatically? I thought the “runpluto.sh” file in the repo would do this.
Is it possible to export a static HTML version with all slider combinations precomputed?
I know that this could lead to very big state space if one is not careful, but it would be a very nice way to host a static interactive notebook. Especially if the computations are more on the expensive side.
I would image it as adding a results cache in javascript for the slider state space.