It is possible to use Leo as a sage notebook (within Ubuntu, not wsl). Right now, without changing Leo!
Two, no three, Ahas make this possible:
- Leo must run within Sage.
- Everything must be installed within Sage.
- Sage prompts are really ipython prompts.
Installing Leo
I installed Leo inside Sage:
sage: !pip install leo
The first time I ran Leo I got a familiar message:
sage: !leo
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found...
But now I knew what to do:
sage: !sudo apt-get install libxcb-cursor0
And now Leo worked!
sage: !leo
setting leoID from os.getenv('USER'): 'edreamleo'
Leo 6.8.1, 6.8.1 branch, build 616c868bbf
2024-07-24 05:19:21 -0500
Python 3.12.3, PyQt version 6.7.3
linux
wrote recent file: /home/edreamleo/.leo/.leoRecentFiles.txt
Executing Sage scripts within Leo
Here is a script from the Sage tutorial:
from sage.all import *
x = circle(
(Integer(0),Integer(0)), Integer(1),
rgbcolor=(Integer(1),Integer(1),Integer(0)))
print('x', x)
x.show()
When Leo runs inside sage we can run this script as a Leo script!! The output (in the Sage console) is:
x Graphics object consisting of 1 graphics primitive
Graphics object consisting of 1 graphics primitive
The graphic doesn't appear automatically, but I expect it will after configuring Sage's viewer.
It is possible to use Leo as a sage notebook (within Ubuntu, not wsl). Right now, without changing Leo!