Making Sagemath available to Raspberry Pi

154 views
Skip to first unread message

Jaap Spies

unread,
Jul 10, 2020, 7:01:17 AM7/10/20
to sage-devel
In a previous post I wrote:

\begin quote
Saying Raspberry Pi is saying education. There are zillion Raspberry Pi's out there.
Almost all of them are running Raspbian, now called Raspberry Pi OS.
On every raspbian system there is an implementation of Mathematica.
Wolfram was clever when he decided to make Matematica available to the
people of Raspberries.

I did some experimentation out of an old book Mathematica Second Edition.
You can really do some math on a Raspberry Pi 4.
[snipped]

I think it is of major importance to have at least a binary for Raspberry Pi OS!

I'm old and have no time and no energy to pursue this to the end, but I plea
someone would take this serious.

Jaap

early adapter of sage
\end quote

I wanted to start a discussion on the need to be present on the Raspberry Pi platform.
But my intentions were buried under a lot of technicalities.

SAGE was intended to by an opensource alternative for the big M's, among them Mathematica.
What we see on the rasbian distribution:
du:
32000 Wolfram/WolframEngine/12.0/AddOns/Applications
36244 Wolfram/WolframEngine/12.0/AddOns
1097480 Wolfram/WolframEngine/12.0
1097484 Wolfram/WolframEngine
1101392 Wolfram/
root@rasp4g:/opt# 

You see Wolfram was very clever in getting Mathematica in raspbian: 1.1 GB of disk space

We will never get that space in the official distro, but I plea to make Sagemath 
more available and known on the Raspberry Pi platform.

There are a lot of computer labs in schools and colleges all running rasbian.
And users easily link Math and Mathematics to Mathematica.
Try Google Search: math Raspberry Pi of raspberry math
and you will be overwhelmed by Wolfram's Mathematica

Do a Google Search: raspberry pi sagemath
and you see some pages from the year 2013 and a page of my website.

The only thing we can do is to try getting Sagemath more visible.
In documentation, on the website and make a binary available.
(William are you here?)

Jaap Spies

Dima Pasechnik

unread,
Jul 10, 2020, 7:03:48 AM7/10/20
to sage-devel
I'm getting the latest Rasberry Pi with 8GB of RAM, we'll see how far
it will do.

> (William are you here?)
>
> Jaap Spies
>
> --
> 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 on the web visit https://groups.google.com/d/msgid/sage-devel/36e28475-07f7-4938-aaed-410526534b18o%40googlegroups.com.

Doris Behrendt

unread,
Jul 10, 2020, 7:09:27 AM7/10/20
to sage-...@googlegroups.com
+1

> Am 10.07.2020 um 13:03 schrieb Dima Pasechnik <dim...@gmail.com>:
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAAWYfq3%2Byaga_CiQmOjKZkO%2BdTFPRvVOx%3Dy9um1ypc3ChC9WuQ%40mail.gmail.com.

Jonathan

unread,
Jul 11, 2020, 8:05:13 AM7/11/20
to sage-devel
Although this is a laudable goal, I think it is important to realize that for many
educational situations there is an alternative that is probably adequate:
SymPy.

SymPy does not have all the capabilities of Sagemath, but is one of the
packages within Sagemath that provides most of the capabilities that are
needed in a symbolic math/CAS system for educational purposes in most
fields.

I think the key is to make the connection between Sagemath and SymPy
capabilities obvious. Think of SymPy as a lightweight/introductory version
of Sagemath.

SymPy can easily be installed on a Raspberry Pi using pip. I have it running on
multiple Pi 3B+ and 4Bs.

Regards,
Jonathan

Jaap Spies

unread,
Jul 12, 2020, 5:22:37 AM7/12/20
to sage-devel


On Saturday, July 11, 2020 at 2:05:13 PM UTC+2, Jonathan wrote:
Although this is a laudable goal, I think it is important to realize that for many
educational situations there is an alternative that is probably adequate:
SymPy.

SymPy does not have all the capabilities of Sagemath, but is one of the
packages within Sagemath that provides most of the capabilities that are
needed in a symbolic math/CAS system for educational purposes in most
fields.


Yes sagemath is unifying all the package you want to use, among them surely SymPy.
 
I think the key is to make the connection between Sagemath and SymPy
capabilities obvious. Think of SymPy as a lightweight/introductory version
of Sagemath.


You are missing my point. It is not what is individually needed. If you knew me you would
know my middle name is "permanent". I wrote same code in SAGE, I used some code on permanents. What else?
You can put that under a fingernail and it gets lost.

I want the name "sagemath" is known in Rasberry Pi circles next to the world wide presence of Wolfram's Mathematica.
Make experiments possible using sagemath. Publishing use cases of sagemath.
I would like to write article in MagPi, the official Raspberry Pi Magazine.
Therefor we need a binary distribution.
Since the end of last year I know you can build sagemath on Raspbian. There are
some errors in sage -ptestlong, most related to timeouts. But a port is nearby.

SymPy can easily be installed on a Raspberry Pi using pip. I have it running on
multiple Pi 3B+ and 4Bs.

Regards,
Jonathan

On Friday, July 10, 2020 at 6:01:17 AM UTC-5 jaap... wrote:

We will never get that space in the official distro, but I plea to make Sagemath 
more available and known on the Raspberry Pi platform.



Dima Pasechnik

unread,
Jul 12, 2020, 7:52:52 AM7/12/20
to sage-devel
I have it now, but need to find a usb keyboard to bootstrap it, it seems.
I would rather plug ethernet cable, and ssh into, but this seems to be unsupported.

Also it is strange that the default OS is 32-bit, which looks like an extra hassle.

Sverre Lunøe-Nielsen

unread,
Jul 12, 2020, 8:27:31 AM7/12/20
to sage-devel
Dima,

> I would rather plug ethernet cable, and ssh into, but this seems to be unsupported.

You can accomplish this by following the instructions under
"3: Enable SSH on a headless Raspberry Pi (add file to SD card on another machine)" found here:

https://www.raspberrypi.org/documentation/remote-access/ssh/

Regards,

Sverre Lunøe-Nielsen
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-...@googlegroups.com.

Dima Pasechnik

unread,
Jul 12, 2020, 10:45:44 AM7/12/20
to sage-devel


On Sun, 12 Jul 2020, 13:27 Sverre Lunøe-Nielsen, <sver...@gmail.com> wrote:
Dima,

> I would rather plug ethernet cable, and ssh into, but this seems to be unsupported.

You can accomplish this by following the instructions under
"3: Enable SSH on a headless Raspberry Pi (add file to SD card on another machine)" found here:

https://www.raspberrypi.org/documentation/remote-access/ssh/

thanks - however the headless install seems to require a modification of the micro SD - something that needs a working reader - and for some reason I can't get it to work on an old MacAir with an old adaptor.

It looks like an oversight that by default it is not already shipped prepared this way.


Can Pi double up as a card reader?

Best
Dima

To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/178ae5a5-8b73-43ca-81b4-9e61082b78b8o%40googlegroups.com.

Jaap Spies

unread,
Jul 12, 2020, 4:07:36 PM7/12/20
to sage-devel


On Sunday, July 12, 2020 at 4:45:44 PM UTC+2, Dima Pasechnik wrote:


On Sun, 12 Jul 2020, 13:27 Sverre Lunøe-Nielsen, <sver...@gmail.com> wrote:
Dima,

> I would rather plug ethernet cable, and ssh into, but this seems to be unsupported.

You can accomplish this by following the instructions under
"3: Enable SSH on a headless Raspberry Pi (add file to SD card on another machine)" found here:

https://www.raspberrypi.org/documentation/remote-access/ssh/

thanks - however the headless install seems to require a modification of the micro SD - something that needs a working reader - and for some reason I can't get it to work on an old MacAir with an old adaptor.

It looks like an oversight that by default it is not already shipped prepared this way.


Since 2016 the Raspberry Pi Organisation disables sshon start up. Why? I don't know.
What is your configuration? What kind of SD card are you using. Is it preconfigured by your
supplier?



Can Pi double up as a card reader?


No, only if you have it up and running you can use an USB cardreader.

Best
Dima

Jaap Spies

unread,
Jul 12, 2020, 5:21:15 PM7/12/20
to sage-devel
Instructions: Go to https://www.raspberrypi.org/downloads/
Download your Pi Imager if you want.
I use BalenaEtcher on an old windows loaptop with card reader.
I could also use another Raspbery Pi with USB card reader to dd the image to the SD card.
My main machine has no card reader at all.

So you need a card reader to write the image.

Download the Raspberry Pi OS, previously called Raspbian: choose "with desktop and recommended software"
There is working underway to release a 64-bit version, but not yet available.

Your SD card is at least 64 GB one. I prefer SanDisk Ultra microSDHC UHS
You want space for several versions of sagemath!
dd or etch, flash or whatever you choose the image to the SD card.

Prepare your Raspberry Pi. Have a powersupply of at least 3A, better 4A.
For best experience connect a monitor or TV with a micro HDMI to HDMI cable.
Choose HDMI-1 the connector next to the power supply.
An USB keyboard and mouse.
Connect ethernet.

Put the power on. The system will boot. Click on the Raspberry, select Preferences -> Raspberry Pi Configuration
Choose hostname and change the password.
In the label Interfaces enable SSH and VNC

Open Chromium, go to the download pages of sagemath, make your pick.
Make a directory /home/pi/sagemath
cd to it
mv or cp /home/Downloads/sage-9.2.beta5.gz .
tar xvf sage-9.2.whatever
cd sage-..

etcetera



Dima Pasechnik

unread,
Jul 13, 2020, 7:06:58 PM7/13/20
to sage-devel
There is an official Rasbrian package for Sage, sagemath, it gives you Sage 8.6.

I suppose it's the result of semi-automatic import of Debian Buster
into Rasbrian.

I did

pi@raspberrypi:~ $ sudo apt install sagemath

and after a long download, I could do

pi@raspberrypi:~ $ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.6, Release Date: 2019-01-15 │
│ Using Python 2.7.16. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
Setting permissions of DOT_SAGE directory so only you can read and write it.
sage:
Exiting Sage (CPU time 0m0.12s, Wall time 0m9.49s).


Naturally one wants newer versions, but still this is a start.

Dima

On Fri, Jul 10, 2020 at 12:01 PM Jaap Spies <jaap...@gmail.com> wrote:
>
> --
> 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.

Jaap Spies

unread,
Jul 14, 2020, 5:49:17 AM7/14/20
to sage-devel


On Tuesday, July 14, 2020 at 1:06:58 AM UTC+2, Dima Pasechnik wrote:
There is an official Rasbrian package for Sage, sagemath, it gives you Sage 8.6.

I suppose it's the result of semi-automatic import of Debian Buster
into Rasbrian.

I did

pi@raspberrypi:~ $ sudo apt install sagemath

and after a long download, I could do

pi@raspberrypi:~ $ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.6, Release Date: 2019-01-15                     │
│ Using Python 2.7.16. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
Setting permissions of DOT_SAGE directory so only you can read and write it.
sage:
Exiting Sage (CPU time 0m0.12s, Wall time 0m9.49s).


Naturally one wants newer versions, but still this is a start.

pi@rasp4g:~/sagemath/sage-9.2.beta4 $ ./sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2.beta4, Release Date: 2020-07-08               │
│ Using Python 3.7.3. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: 

It would be great to get it in debian and raspbian!

Jaap Spies

unread,
Jul 14, 2020, 6:02:57 AM7/14/20
to sage-devel
 For serious work my advise is to use an ssd. The latest RP4's allow booting from USB.
On my older system I have to do a trick: booting from SD card and run the system from / (root)
on the ssd. This faster and safer.

Some suppliers have integrated systems available: My home supplier: https://www.freva.com/our-shop/

Jaap


Dima Pasechnik

unread,
Jul 14, 2020, 3:21:52 PM7/14/20
to sage-devel
Debian bullseye has Sage 9.0.
https://packages.debian.org/bullseye/sagemath
and
https://tracker.debian.org/pkg/sagemath
We try to help Debian people to update to newer versions.

>
>
>
>>
>> Dima
>>
>> On Fri, Jul 10, 2020 at 12:01 PM Jaap Spies <jaap...@gmail.com> wrote:
>> >
>>
> --
> 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 on the web visit https://groups.google.com/d/msgid/sage-devel/847712ee-1213-4ea6-9dcf-1d483e6a90d4o%40googlegroups.com.

Grant Ellis

unread,
Jul 17, 2020, 6:41:27 PM7/17/20
to sage-...@googlegroups.com
Hello everyone,

In regards to the interest in making Sagemath present on the Raspberry Pi platform it would be helpful in also having the GPIO module available in Sagemath.

It would be helpful to have Sagemath be able to access electronic circuits e.g. A/D, D/A converters, motor controllers, sensors etc via Raspberry Pi GPIO module.

Grant Ellis



--
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.

Dima Pasechnik

unread,
Jul 18, 2020, 7:23:08 AM7/18/20
to sage-devel


On Fri, 17 Jul 2020, 23:41 Grant Ellis, <grant...@gmail.com> wrote:
Hello everyone,

In regards to the interest in making Sagemath present on the Raspberry Pi platform it would be helpful in also having the GPIO module available in Sagemath.

It would be helpful to have Sagemath be able to access electronic circuits e.g. A/D, D/A converters, motor controllers, sensors etc via Raspberry Pi GPIO module.

if gpio is just a Python3 package,
it can easily be installed into Sage,
by 

sage --pip install gpio


Jonathan

unread,
Jul 18, 2020, 8:29:17 AM7/18/20
to sage-devel
I am working on making A/D, primarily on Raspberry Pis, easier to use within the Jupyter notebook by providing some GUI elements for setting up the data collection. Everything is available as python 3 packages so should install in a Sagemath kernel. I haven't tried doing that as you have to be careful not to overload the Pis. Testing has only been done with a standard python 3 kernel. To learn more see the project repositories at: https://github.com/JupyterPhysSciLab. The A/D stuff (JupyterPiDAQ: https://github.com/JupyterPhysSciLab/JupyterPiDAQ) is the largest part of the project so far.

Jonathan
Reply all
Reply to author
Forward
0 new messages