Binder and Sagemath

From the past I have been using successfully Sagemath with Binder. Following this discussion in sage-devel forum, it seems that now Sagemath does not work. I tried one previously successful page with no success.

Thansk, Enrique.

Retried again. These are the logs:

Waiting for build to start…
Built image, launching…
Launching server…
Server requested
2021-10-09T09:06:12.557710Z [Normal] Successfully assigned turing/jupyter-enriqueartal-2dqu-2dformsingularity-2dhak2yp3i to aks-user-14930255-vmss00000j
2021-10-09T09:06:13Z [Normal] Container image “jupyterhub/mybinder.org-tc-init:2020.12.4-n655.hfe65496” already present on machine
2021-10-09T09:06:13Z [Normal] Created container tc-init
2021-10-09T09:06:13Z [Normal] Started container tc-init
2021-10-09T09:06:14Z [Normal] Pulling image “turingmybinder/binder-prod-r2d-g5b5b759-enriqueartal-2dquadraticformsingularity-5b0133:3af764e78f2ec3a2bd5b10e5713be2222f9c2202”
2021-10-09T09:07:04Z [Normal] Successfully pulled image “turingmybinder/binder-prod-r2d-g5b5b759-enriqueartal-2dquadraticformsingularity-5b0133:3af764e78f2ec3a2bd5b10e5713be2222f9c2202”
2021-10-09T09:07:10Z [Normal] Created container notebook
2021-10-09T09:07:10Z [Normal] Started container notebook
Spawn failed: Timeout
Launch attempt 1 failed, retrying…
Server requested
2021-10-09T09:11:16.991402Z [Normal] Successfully assigned turing/jupyter-enriqueartal-2dqu-2dformsingularity-2d86zjjq1g to aks-user-14930255-vmss00000j
2021-10-09T09:11:17Z [Normal] Container image “jupyterhub/mybinder.org-tc-init:2020.12.4-n655.hfe65496” already present on machine
2021-10-09T09:11:18Z [Normal] Created container tc-init
2021-10-09T09:11:18Z [Normal] Started container tc-init
2021-10-09T09:11:18Z [Normal] Container image “turingmybinder/binder-prod-r2d-g5b5b759-enriqueartal-2dquadraticformsingularity-5b0133:3af764e78f2ec3a2bd5b10e5713be2222f9c2202” already present on machine
2021-10-09T09:11:18Z [Normal] Created container notebook
2021-10-09T09:11:19Z [Normal] Started container notebook
Spawn failed: Timeout
Launch attempt 2 failed, retrying…
Server requested
2021-10-09T09:16:27.056172Z [Normal] Successfully assigned turing/jupyter-enriqueartal-2dqu-2dformsingularity-2d719v46if to aks-user-14930255-vmss00000j
2021-10-09T09:16:27Z [Normal] Container image “jupyterhub/mybinder.org-tc-init:2020.12.4-n655.hfe65496” already present on machine
2021-10-09T09:16:28Z [Normal] Created container tc-init
2021-10-09T09:16:28Z [Normal] Started container tc-init
2021-10-09T09:16:28Z [Normal] Container image “turingmybinder/binder-prod-r2d-g5b5b759-enriqueartal-2dquadraticformsingularity-5b0133:3af764e78f2ec3a2bd5b10e5713be2222f9c2202” already present on machine
2021-10-09T09:16:28Z [Normal] Created container notebook
2021-10-09T09:16:28Z [Normal] Started container notebook

It works with sagemathinc/cocalc:latest

1 Like

You can find an example of using Sage with Binder at

It used to be docker based; however the docker image were
not functional any more, and in the mean time conda packaging
of sage has matured a lot. Also generally speaking conda is
preferable for binder.

So I switched recently to a conda-based binder configuration. It’s
not as flexible as the previous configuration though (e.g. it does
not come with kernels for GAP, Singular, …).

1 Like

Is it possible to use this approach in mybinder.org?

Yes: you can try it by following the binder link in the README of
the above repo.

To apply it to your own repo, it should be enough to copy over
the environment.yml file.

1 Like

I have tried the binder link of the above repo, it launches JupyterNotebook, but the Sagemath kernel is not connected (restart does not help).
It behaves the same also for my repo with the same environment.yml.
Do you know how to fix this? Thanks.

@Legersky, the SageMath 9.5 kernel is working on the first demo page in sessions for me.

Minor issue noted while looking into it:
The only thing I see not working correctly on the first page that comes up as the session launches, at this moment, is the ipywidget invoked from the penultimate code cell IntSlider(3,1,5) isn’t rendering. It just displays the text 𝙸𝚗𝚝𝚂𝚕𝚒𝚍𝚎𝚛(𝚟𝚊𝚕𝚞𝚎=𝟹, 𝚖𝚊𝚡=𝟻, 𝚖𝚒𝚗=𝟷) in the output area. ipywidgets being added to the environment.yml file should fix that, especially since running %conda install ipywidgets in the session and re-running the cells involved again fixed it.

1 Like