Pluto notebooks on Colab's kernel proxy port

metrizable
Mon, 31 Mar 2025 21:48:21 +0000
Tooling

There has been some interest in using Pluto notebooks in Colab, and although I realize it’s not quite the fully supported experience that’s requested, I thought I’d share one approach to get going:

using Pkg

Pkg.add("Pluto", io=devnull)

using Pluto

port = 1234
@async Pluto.run(; port=port, require_secret_for_open_links=false, require_secret_for_access=false)

Then, using the same mechanism exposed in the google.colab Python library, one can obtain a link through Colab’s proxy to the host:

using IJulia

url = "https://localhost:$port"

display(HTML("""

(async (port, element) => {
    var outputDiv = document.getElementById('js-output');
    const url = await google.colab.kernel.proxyPort(port);
    const anchor = document.createElement('a');
    anchor.href = new URL('/', url).toString();
    anchor.target = '_blank';
    anchor.setAttribute('data-href', url + '/');
    anchor.textContent = '$url';
    outputDiv.appendChild(anchor);
  }) (1234, window.element)
"""))

We currently do not pre-install Pluto.jl, so install and startup takes a minute or so:

Now, visiting the output link launches a Pluto notebook running on your Colab VM:

5 posts - 5 participants