HACKER Q&A
📣 janalsncm

Fastest way to turn a Jupyter notebook into a website these days?


I am mainly familiar with AWS but the configuration of S3, lambdas (including creating layers for python dependencies), api gateway, cloudfront, and all of the obscure permissions are just a major pain in the butt. I spent maybe 5 hours building something in Jupyter and then an entire day just dealing with AWS.

Is there an easier way? If I gave you a python script and some html what would you use to get it behind a www in the least amount of time possible?


  👤 kwamenum86 Accepted Answer ✓
No need to use AWS at all -

Jupyter Nbconvert: Jupyter Nbconvert is a command-line tool that allows you to convert Jupyter notebooks into various formats, including HTML, PDF, and Markdown. You can use the nbconvert command to convert your Jupyter notebook into an HTML file, which you can then upload to a web hosting service or a file-sharing platform like GitHub or GitLab. To use this method, you will need to have Jupyter installed on your computer.

Binder: Binder is a free service that allows you to turn your Jupyter notebook into a live, interactive website that can be accessed by anyone. Binder creates a virtual environment that includes all the dependencies required to run your notebook and launches it in a web browser. To use this method, you will need to upload your Jupyter notebook to a GitHub repository and provide a link to your repository to Binder.

Google Colab: Google Colab is a free cloud-based service that allows you to create and run Jupyter notebooks in a web browser. You can create a new notebook in Colab, write your code, and then export it as an HTML file using the nbconvert command. You can then download the HTML file and upload it to a web hosting service or file-sharing platform.


👤 smcl
To be honest if you are comfortable writing Python you may want to just use plain old nbconvert. It'd take you a matter of minutes to get some kind of HTML output that you can then spend as much or as little time as you like customising by using your own templat, then publish somewhere using a shell script.

It's really not too tough: https://nbconvert.readthedocs.io/en/latest

Note that this is purely if you want to present your notebook as a static page. If you want it to be more interactive you're going to end up with something more complex.


👤 pplonski86
Im working on Mercury framework to solve this problem. Notebooks can be static or dynamic. You can hide code in notebook and show only outputs. You can easily add authentication.

The framework repository at GitHu https://github.com/mljar/mercury

Im working also on cloud offering so you will upload notebooks and set domain. It is available in alpha at https://cloud.runmercury.com


👤 jszymborski
Quarto is a thing https://quarto.org/

👤 pea
You can build web apps from Jupyter using Datapane [0]. I'm one of the founders, so let me know if I can help at all.

You can either export a static site [1] (and host on GH pages or S3), or, if you need backend logic, you can add Python functions [2] and serve on your favourite host (we use Fly).

We have specific Jupyter integration to automatically convert your notebook into an app [3].

[0] https://github.com/datapane/datapane

[1] https://docs.datapane.com/reference/reports/#datapane.proces...

[2] https://docs.datapane.com/apps/overview/

[3] https://docs.datapane.com/reports/jupyter-integration/#conve...


👤 sideshowb
Upload to Google colab, share link?

Not very polished I admit but it's allowed a recent prototype I built to get enough traction that someone else wants to build the proper version now. I'll tell them to come and check this thread ;-)

(Plot twist if that person is op...)


👤 paulgb
Is the goal for users to be able to execute notebook code, or just view the notebook?

If interactive, http://tmpenv.com lets you clone a github repo repo, drop your notebook in, and gives you a button for spinning up instances of it. We’re a few weeks away from making it generally available but I’m happy to give you access if you’re interested.

If not interactive, most static hosting sites will let you run nbconvert to turn an ipynb file into HTML.


👤 anigbrowl
Good question. If you just need to get something up as a demo, PythonAnywhere seems quite good. But if you need something simple that you can deploy to production, I too would like hear recommendations.

Plotly Dash is a pretty painless all-python-no-javascript way to build an interactive UI on top of whatever your data source is, but I have no idea how well (or not) it scales.


👤 kristjansson
Perhaps https://github.com/voila-dashboards/voila?

Not sure about ease relative to other alternatives.


👤 baq
If civilian hardware is enough, try jupyterlite - runs 100% in the browser

https://jupyterlite.readthedocs.io/en/latest/try/lab/

Can be hosted out of GitHub pages.


👤 sixhobbits
Maybe replit.com for hosting seeing as you mention "python script and HTML" at the end. The simplest way I've seen to go from code -> hosted URL.

If you want to use an actual .ipynb file as the "python script", then I'd add in Streamlit.

Probably a bit dated now, but I tried a bunch of these tools when I was working on a comparison article[0] that might still be useful.

https://www.datarevenue.com/en-blog/data-dashboarding-stream...


👤 MossieB
jupyter books on github pages https://jupyterbook.org/en/stable/

👤 mlajtos
Upload your ipynb to Deepnote and publish as an app. That simple.

https://deepnote.com


👤 zikduruqe
In the past, I just run it inside a docker container, and expose port 8888 to the network.

Example (not my repo) - https://github.com/MKAbuMattar/dockerized-jupyter-notebook/b...


👤 SilverBirch
Can I ask what you're expecting out of this? Because if you're generating something static... then just render it to html and upload, generally with stuff like plotly it'll even handle the javascript to let you have interactive charts. If you're talking about publishing the notebook and expecting people to modify it and run it then then as other people have said there are services that host notebooks as a service, you shouldn't be AWSing that yourself. If you want something that looks more like a website, allowing users to modify stuff within bounds but quite well structured then something like Dash might be good (but make sure to preprocess your data), and they've got ways of plugging into cloud for deployment.

👤 version_five
I'm curious what comes to people's minds reading this - as in is there some "usual" turn-a-notebook-into-a-website task?

Forgive my probably being pedantic: if it's the whole notebook with all it's functionality of changing code in cells that's to be shared, I'd have said colab as someone else did.

If it's some of the plots or data frames to be visualized with some means of adjusting them, streamlit or a similar product, as long as it doesn't have to be too polished. Or plotly/dash? (Irrc, I may have the name wrong).

Or if it's just running some code and returning something, flask, e.g. could be fine.

Imo it really depends on the use case.



👤 polishdude20
On that note, is there some site where I can host regular html, JavaScript etc but I don't write the code locally but on some web ide? I'd like to say, save my file and see the change pop up on my public domain instantly after a refresh. I don't want to worry about hooking up ssh or rsync tunneling or any file uploads. All files and code should be directly edited through the web ide and live on the remote server.

👤 bayesian_horse
"Turning jupyter notebook into a website" is a very broad task. From the question body I gather the specific task is to deploy a jupyter notebook server. For that you just need a generic VM, install and start up jupyter with the right configuration options about authorization and ports, then point a dns and preferably a reverse proxy with SSL to it. That shouldn't require S3, lambdas, api gateway, cloudfront and so on, even on AWS.

👤 analog31
I use nbconvert and upload to Github Pages. I also put the .ipynb file up there in case anybody wants to try using my code. I've also tried Colab and Jupyter Lite, both work fine.

None of these produce slick professional-looking pages, but I prefer just exposing my source code and letting people use it. Also, my stuff isn't profound enough to deserve real web hosting, or the effort to turn it into "software."


👤 TheAlchemist
I would probably go with Streamlit - it's really very easy to turn a python script into something good looking.

If it's supposed to serve a lot of users, then Dash.


👤 nijave
I don't have much experience with them but I think Paperspace.com might be worth a look. I think it's positioned sort of like Heroku for ML.

👤 skl11
Have you tried using the free tier of Hex (https://www.hex.tech)?

👤 borzunov
Consider making a Streamlit or Gradio app and hosting it at Hugging Face Spaces: https://huggingface.co/spaces/launch This allows you to make a simple frontend using Python only, then host it for free.

👤 rhizome31
Binder is relatively easy to use but it hasn't been always very reliable. Not sure if that changed. I haven't tried it in a long time. URL: https://mybinder.org/

👤 zzbn00
My suggestion is https://panel.holoviz.org/

Fully open sourced, makes it easy to make reactive apps with small changes, can even configured as a graphical REPL.


👤 villgax
That's the worst combination of things I've ever heard of. If you have python chops just use Streamlit or Django. If not then what's stopping you from using Markdown

👤 mjburgess

👤 nemoniac
Convert to orgmode using

    jupyter nbconvert --to orgmode a.ipynb
Then export it directly from orgmode to html (or pdf or latex or info or ...)

👤 rg111
Can vouch for both Quarto and Jupyter Book.

Used both tens of times.


👤 muyuu
your task is very very broad

you mention you don't want to deal with AWS, if it's because of ad-hoc installation concerns and nothing else you can just run your notebooks in ready-made solutions like Google Colab, or Jupyter-book in Github ( https://github.com/executablebooks/jupyter-book ))

that would cover a lot of use cases right away without next to no learning curve

If you don't want to deal with AWS or similar, in that case:

- if it's a static notebook then you can obviously render it and serve the web content (might seem obvious but needs to be considered)

- if it's dynamic but has light hardware requirements, you can try jupyterlite which runs in the browser and should do a pyodine (webassembly CPython kernel) can do: https://jupyterlite.readthedocs.io/en/latest/try/lab/

- otherwise, you can try exposing a dockerised jupyter env ( as in https://github.com/MKAbuMattar/dockerized-jupyter-notebook/b... ) or even better a nixified one ( https://github.com/tweag/jupyenv )

there might be other approaches I'm missing, but I think that's pretty much it that doesn't entail some proprietary solution or an ad-hoc installation as you've been doing


👤 pierremenard

👤 ipunchghosts
DAE find jupyter notebooks cumbersome to use for serious research?

👤 tus666
I hate to say it, but probably ChatGPT.

👤 padheyam
You could check out Anvil.

👤 quickthrower2
Google Colab

👤 rhacker
Probably at minimum something running in a sandbox like Docker.