Using Sage on Windows

308 views
Skip to first unread message

seb....@gmail.com

unread,
Oct 16, 2024, 2:16:58 AM10/16/24
to sage-devel
Dear Sage developers,

As you all know, there are some obstacles to using Sage on Windows. For a few years, this was much easier due to binaries built with Cygwin. Since this has been discontinued, we direct Windows users to the Linux installation procedures via WSL. Alternatively, we direct them to use our Docker images on Docker Hub.

For people with development experience, these installation instructions are fine. But if we want to appeal to people without such experience, we should offer more help.

Recently, Julian Rüth developed an installation script that simplifies the installation process via WSL (see this comment on #33765 and these release notes of the Flatsurf project).

For the approach with our images on Docker Hub, I started implementing a Powershell script that guides the user through the process. You can find it in this repository along with documentation in the `README.md` file. Please consider it a draft illustrating a suggestion and feel free to help make it into something useful.

Note that you can test the main part of the tool even if you don't have access to a system running Windows. At least if you are using Linux (I don't know about Mac), you can follow section 4 of the documentation.

Sebastian

Eric Gourgoulhon

unread,
Oct 16, 2024, 7:45:14 AM10/16/24
to sage-devel
Thank you very much Julian and Sebastian for these initiatives!
On ask.sagemath, we see too many messages from Windows users not managing to install Sage. A recent example is
We also see messages from users stuck to Sage 9.3, which is the latest Cygwin version...

Eric. 

Tobia...@gmx.de

unread,
Oct 17, 2024, 12:35:59 AM10/17/24
to sage-devel
I'm very happy to see improvements to the Windows installation. I don't have the time right now to try your powershell script, but it looks like a nice walk-through for not-so-technical users. Do you want to add it to the docs?

Another alternative would be to import the docker image as a WSL distribution. From a user perspective, this would be simply setting up WSL, downloading the docker image as a tar file and then run wsl --import SageMath <path to the tar file>. The tar file could be automatically generated from the docker image upon releasing a new version of sage (in github ci). See https://learn.microsoft.com/en-us/windows/wsl/use-custom-distro. But I don't have experience with this mode of installation, so I don't know if there are hidden shortcomings.

Kwankyu Lee

unread,
Oct 17, 2024, 2:00:18 AM10/17/24
to sage-devel
Another alternative would be to import the docker image as a WSL distribution. From a user perspective, this would be simply setting up WSL, downloading the docker image as a tar file and then run wsl --import SageMath <path to the tar file>. The tar file could be automatically generated from the docker image upon releasing a new version of sage (in github ci). See https://learn.microsoft.com/en-us/windows/wsl/use-custom-distro. But I don't have experience with this mode of installation, so I don't know if there are hidden shortcomings.

I am experimenting this mode of installation. Yes, this may be the easiest way for a windows user to get a working sage install.

I auto-created a powershell script  to make this even easier:


Needs test. The tar file is currently a github artifact, and is not freely downloadable. It seems that sagemath organization membership is necessary to access it. 

The wsl image tar file is of size about 6GB.  It would be nice if we have a public file server to accommodate the tar file.



Kwankyu Lee

unread,
Oct 17, 2024, 2:30:59 AM10/17/24
to sage-devel
On Thursday, October 17, 2024 at 3:00:18 PM UTC+9 Kwankyu Lee wrote
The wsl image tar file is of size about 6GB.  It would be nice if we have a public file server to accommodate the tar file.

The gzipped file is just 1.8GB. I may use release assets for some time.


 

seb....@gmail.com

unread,
Oct 18, 2024, 3:41:18 AM10/18/24
to sage-devel
> Do you want to add it to the docs?

Yes! But first there should be something like a review based on the testing experiences of other users.


> Another alternative would be to import the docker image as a WSL distribution

Thanks for the hint. My impression is that this is essentially the approach Julian took. The main difference with my approach is that the decision of which version of Sage to install has to be made at installation time. If you use Docker, this is more of a runtime decision. With my approach, the user selects the Sage version from a list (see section 2.3 in the documentation). Installing Sage is then done simply by `docker pull`. This makes it easier to upgrade Sage, keep a previous version for a while, and use multiple Sage versions in parallel.

seb....@gmail.com

unread,
Oct 18, 2024, 3:45:39 AM10/18/24
to sage-devel
> I auto-created a powershell script  to make this even easier ...

Interesting! How did you auto-create that? With a translation tool?

> Needs test.

I tried it in a Hyper-V guest running a freshly installed Windows 11 Home. I couldn't run the script by copying the code into a Powershell terminal. But after saving it in a file test.ps1, it ran through (after a reboot due to WSL activation), but Sage doesn't appear on Linux distributions. This is what I got:
TestWSLimport.png

Kwankyu Lee

unread,
Oct 18, 2024, 10:58:36 AM10/18/24
to sage-devel
On Friday, October 18, 2024 at 4:45:39 PM UTC+9 seb....@gmail.com wrote:
> I auto-created a powershell script  to make this even easier ...
Interesting! How did you auto-create that? With a translation tool?

Just by github action :-) 

> Needs test.

I tried it in a Hyper-V guest running a freshly installed Windows 11 Home.

Thanks for trying. Meanwhile, I improved the installer. Now it is in https://github.com/sagemath/sage-binder-env/releases/tag/v10.4

seb....@gmail.com

unread,
Oct 18, 2024, 5:03:05 PM10/18/24
to sage-devel
Have you looked for overlap with Julian's work?

I noticed a regression in your new version. It started with "Downloading and extracting SageMath..." before installing WSL.

Kwankyu Lee

unread,
Oct 18, 2024, 7:35:15 PM10/18/24
to sage-devel
On Saturday, October 19, 2024 at 6:03:05 AM UTC+9 seb....@gmail.com wrote:
Have you looked for overlap with Julian's work?

No. I had no time :-) My installer installs a minimized Sage (no build facility, no optional package, no local docs), basically the same sage that you get from the sage-binder-env (https://github.com/sagemath/sage-binder-env).
 
I noticed a regression in your new version. It started with "Downloading and extracting SageMath..." before installing WSL.

The "first version" was a primitive proof of concept. The "new version" works better. Details should be improved yet.


Kwankyu Lee

unread,
Oct 19, 2024, 12:28:36 PM10/19/24
to sage-devel

seb....@gmail.com

unread,
Oct 21, 2024, 2:23:16 AM10/21/24
to sage-devel
> The third version is ready:

I tested it on Saturday, but with the same result as before. I will open an issue in the sage-binder-env repository later on to document my tests there.

Kwankyu Lee

unread,
Oct 21, 2024, 3:56:39 AM10/21/24
to sage-devel
On Monday, October 21, 2024 at 3:23:16 PM UTC+9 seb....@gmail.com wrote:
> The third version is ready:

I tested it on Saturday, but with the same result as before.

Right. I missed your point. The installer's check for WSL installation was deficient. Now I made an improvement. Let me know how it works for you.  

 

seb....@gmail.com

unread,
Oct 22, 2024, 12:57:34 PM10/22/24
to sage-devel
> Let me know how it works for you

Reply all
Reply to author
Forward
0 new messages