How can I setup a standalone pyscript server?

Pyscript is very promising and interesting!

I downloaded PyScript from and installed it on ubuntu 18 server successfully. But then I found it is NOT standalone, means it depends on pyodide.js at I traced the URL and downloaded the pyodide.js and made changes to pyconfig.ts accordingly, but it was not surprisingly failed to work.

I found the packages.json file refers to a lot of .whl files that may assemble Anaconda. So, it is clear that PyScript needs Anaconda (no doubt, it is quite natural). My question is: how can I set up a PyScript server without direct connection to the Internet? I have to use it behind the firewall, a simple bypass may not help because the heavy trafic to the CDN server.

Thank you in advance for your kind tips!

1 Like

nice to meet you.

The most basic method is discussed on Please refer to the URL if you like.
Simply put, you can build a server with python.

Regards, you.

Thank you for the reply.
I’d read the discussion on github. If there is no misunderstanding, the discussion suggests me to build the pyodide by hand before achieving my “real offline”. And the how-to tutorial has not done yet. Or, has the tutorial already completed?

The simplest method is to load your PyScript program into a web browser. Open the Chrome debugger and go to the Network tab. That will show you everything that was downloaded and the URLs. Download each URL and store it on your web server. You will need to use a web server.

Note: that method will only download the files your program requires beyond the core files.

Modify your PyScript application to tell it where to download PyScript:

        - autoclose_loader: true
        - runtimes:
                src: "/pyscript/pyodide.js"
                name: pyodide-0.20
                lang: python

Then set up a web server such as Apache. I wrote an article on how to do that. You can also use Nginx or a custom server (Flask, Django, etc) with the correct setup.

There are other methods, such as using a WebWorker, which enables your application to run without the Internet.


Thank you! I’d tried but not success yet. I will send another post here when done. Anyway, you show me the way, thanks!