Can the web browser run a Python or R program?

Python and R are written in C, and browsers can run C programs

In my last post, I explained that web browsers can actually run programs in most compiled languages with a recent technology known as WebAssembly.

But many scientists and engineers use Python/numpy/pandas, and Python is a interpreted language. Can the web browser run Python?

Since the Python interpreter is written in C, and the browser can run C, it turns out it’s possible to create a version of Python that runs on the browser. Some people have done this; the project is called Pyodide. It’s not without problems; for example, it takes maybe 10 seconds to import pandas.

In theory, the same thing is possible for R. However I haven’t found any project that does this.

I’m not mentioning all this so that you try Pyodide or any kind of WebAssembly. I think that WebAssembly is one of the things that doesn’t appeal to scientists and engineers. I’m mentioning it so that you are aware of the possibilities.