I have a GitHub pages website on which I'd like to run commands from SciPy. The user will input three values (A, B, C), and a python code will find the optimal nontrivial values: X, Y, Z such that X^A+Y^B=Z^C holds.

Pyodide sounds like my best chance to do so. But, I am not sure how I can get input from the user and how to let Pyodide compute the optimization process to find the values of X, Y, Z.

Edit: this is possible (see the accepted answer), however, I used streamlit which was much easier to work with.

  • I've also added a demo deployed on github pages. check out my updated answer. Sep 12, 2020 at 22:46

2 Answers 2


The answer is yes. All you need to do is to include Pyodide to your web page:

  <script type="text/javascript">
    window.languagePluginUrl = 'https://pyodide-cdn2.iodide.io/v0.15.0/full/';
  <script src="https://pyodide-cdn2.iodide.io/v0.15.0/full/pyodide.js"></script>

load required packages and, finally, run your python code

  .then(()=>pyodide.loadPackage(['numpy', 'scipy', 'matplotlib']))
              import sys
          console.log(pyodide.runPython('print(1 + 2)'));

Here is the official documentation and an article about it

I also created a simple live demo

Update 1: Here is an extended demo deployed on Github pages (source code). I'm also going to write a small guide, so stay tuned.

Update 2: Here is a tutorial


I'm afraid that what you're trying to do isn't possible. Github is a code repository not an IDE (Integrated Development Environment), which means that it's a storage location for code, not for executing it. You will need to create and test your script using another program and then upload (push) this script to your repository. After this, users will be able to download (clone) your repository and run it themselves. I suggest you read a Github how to (link) if you want more information on this.

To create and test your script you can either download a client such as Pycharm. Or, if you do not want to download anything, you can use Google Colab, here you can run python code online and it's possible to save your script to Github.

Note that, though it is possible to run code on Github since the introduction of Github actions, this is meant for building/testing/publishing packages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.