An Experimental Port of SageMath to Browser via WebAssembly (v86)

68 views
Skip to first unread message

Yanshu Wang

unread,
Feb 5, 2026, 11:00:24 PM (2 days ago) Feb 5
to sage-devel
Hello.

I am happy to share my experimental port of SageMath to Browser in client side.

Try it here:


Screenshot on Chrome:

chrome.png

The drawback is that it will download 1.5GB memory state file. (It can use these cache later.) And the computation is quite slow. You may always open the browser console to see its downloading status.

This is a screenshot of doing integration:

integration.png
Source code and build guidance:


If you just want to host it or run a local server, simply clone this repository and upload to the static site hosting provider or run 'make run'.

Yanshu Wang

Dima Pasechnik

unread,
Feb 6, 2026, 8:02:36 AM (yesterday) Feb 6
to sage-...@googlegroups.com
in Firefox, it works, although the startup is very slow, it takes several minutes.
Then it's not too bad.
Is there a reason for using Sage 9.5, which is quite old?

Dima

--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/sage-devel/09feb2d3-91c7-423a-aefa-07acaaac755cn%40googlegroups.com.

Yanshu Wang

unread,
Feb 6, 2026, 8:49:27 AM (yesterday) Feb 6
to sage-devel
Hello Dima.

Thanks for your feedback.

SageMath-in-Browser uses the v86 emulator to run Debian-12 with SageMath installed via apt. Currently, v86 only supports emulating the x86 architecture. For SageMath installation methods on Linux, as far as I know, only the Debian apt repository provides the prebuilt binary for the x86 architecture. (Conda-forge does not provide prebuilt binary for 32-bit x86 either, as I found.) So, the version is Sage 9.5, as provided in Debian-12 repository. You can see the Dockerfile used during the build process for more details.

I can try to adjust the Dockerfile and build SageMath from source. But that could be a bit more challenging.

Yanshu Wang

Georgi Guninski

unread,
1:19 AM (18 hours ago) 1:19 AM
to sage-...@googlegroups.com
Nice :)
At the cost of performance, you get the security of not allowing
remote native code execution (like `system("rm -rf /ANYTHING")`) on
the server, right?

Yanshu Wang

unread,
2:01 AM (17 hours ago) 2:01 AM
to sage-devel
Yes, you are right.

I tried to use Nix to install Sage 10.7 on x86 architecture and port to web in the same manner. But it fails. What is worse is that I heard Nix is dropping support for 32-bit platform and prebuilt pacakges (link). If anyone knows an easy method to install SageMath on x86 linux, please tell me and that could help me speed up the progress a lot.

Another benefit for WebAssembly port of SageMath is that it is cross platform and can be easily ported to Android/iOS/Windows using tools like capacitor or cordova or electron.

Yanshu Wang

Georgi Guninski

unread,
4:36 AM (15 hours ago) 4:36 AM
to sage-...@googlegroups.com
If you need a set of static files served from a web server, then you
can install some 32 bit i386 distro in a virtual machine (very easy if
you find the distro) and build 32 bit sage there. Probably the newer
the distro, the easier is to build sage.
Reply all
Reply to author
Forward
0 new messages