ENB: Working with SageMath

68 views
Skip to first unread message

Edward K. Ream

unread,
Oct 14, 2024, 10:44:53 AM10/14/24
to leo-editor

SageMath is an open-source alternative to Mathematica. I'll be using it while studying math. This thread will discuss issues relating to installing SageMath on Linux and Windows (wsl).


Status


- Installed a binary image of SageMath on wsl.

- Built SageMath from sources on Ubuntu.

- Failed twice to build SageMath from sources on wsl.

- Installed Leo on wsl, but Leo does not work.

- Upgraded Windows 11 from "Home" to "Pro," attempting to fix Leo. Problems remain.


Summary


- It's convenient to use SageMath on Windows via wsl.

- For now, Leo does not need to work in wsl.

  Leo does, of course, work on the real Ubuntu.

- I'll install Mint on wsl, hoping to get Leo working there.


Thanks to the usual suspects for their help and encouragement!


Edward

Thomas Passin

unread,
Oct 14, 2024, 11:00:28 AM10/14/24
to leo-editor
Creating virtual machines with VirtualBox is another way to get a Linux OS to run Leo/Sagemath on. They never run quite as smoothly as when installed directly on the computer but they can be very workable.

BTW, I consistently notice that LeoPyRef opens *much* more quickly on Linux than Windows.  I wonder if anyone else has noticed this.  It will be true for other outlines but LeoPyRef is the biggest and most complex outline that most of us will be opening. On the same computer:

LeoPyRef linux VM: read outline in 0.86 seconds
LeoPyRef Windows: read outline in 6.52 seconds

Edward K. Ream

unread,
Oct 14, 2024, 11:11:34 AM10/14/24
to leo-e...@googlegroups.com
On Mon, Oct 14, 2024 at 10:00 AM Thomas Passin <tbp1...@gmail.com> wrote:

Creating virtual machines with VirtualBox is another way to get a Linux OS to run Leo/Sagemath on. They never run quite as smoothly as when installed directly on the computer but they can be very workable.

Thanks for the tip.  I'll look into it.

BTW, I consistently notice that LeoPyRef opens *much* more quickly on Linux than Windows.  I wonder if anyone else has noticed this.  It will be true for other outlines but LeoPyRef is the biggest and most complex outline that most of us will be opening. On the same computer:

LeoPyRef linux VM: read outline in 0.86 seconds
LeoPyRef Windows: read outline in 6.52 seconds

Iirc, LeoPyRef loads in approximately the same time on Windows 11 and Ubuntu.

Window: about 2 sec.
Ubuntu: not likely much faster.

Edward

Thomas Passin

unread,
Oct 14, 2024, 12:03:54 PM10/14/24
to leo-editor
On Monday, October 14, 2024 at 11:11:34 AM UTC-4 Edward K. Ream wrote:
On Mon, Oct 14, 2024 at 10:00 AM Thomas Passin <tbp1...@gmail.com> wrote:

Creating virtual machines with VirtualBox is another way to get a Linux OS to run Leo/Sagemath on. They never run quite as smoothly as when installed directly on the computer but they can be very workable.

Thanks for the tip.  I'll look into it.

BTW, I consistently notice that LeoPyRef opens *much* more quickly on Linux than Windows.  I wonder if anyone else has noticed this.  It will be true for other outlines but LeoPyRef is the biggest and most complex outline that most of us will be opening. On the same computer:

LeoPyRef linux VM: OpenSUSE read outline in 0.86 seconds
LeoPyRef Windows 10: read outline in 6.52 seconds
        LeoPyRef linux VM Ubuntu 22.04: read outline in 1.35 seconds

Iirc, LeoPyRef loads in approximately the same time on Windows 11 and Ubuntu.

Window: about 2 sec.
Ubuntu: not likely much faster.
Much faster (1.35 vs 6.52 sec)

Thomas Passin

unread,
Oct 14, 2024, 12:19:51 PM10/14/24
to leo-editor
If you want to try going with VirtualBox, I can give you some coaching to ease the way.

Edward K. Ream

unread,
Oct 14, 2024, 12:54:01 PM10/14/24
to leo-e...@googlegroups.com
On Mon, Oct 14, 2024 at 11:03 AM Thomas Passin <tbp1...@gmail.com> wrote:

> EKR: Iirc, LeoPyRef loads in approximately the same time on Windows 11 and Ubuntu.


Window: about 2 sec.
Ubuntu: not likely much faster.

> TBP: Much faster (1.35 vs 6.52 sec)

One of life's mysteries. I'll check on Ubuntu later today.

Edward

Edward K. Ream

unread,
Oct 14, 2024, 12:55:50 PM10/14/24
to leo-e...@googlegroups.com
On Mon, Oct 14, 2024 at 11:19 AM Thomas Passin <tbp1...@gmail.com> wrote:
If you want to try going with VirtualBox, I can give you some coaching to ease the way.

Thanks for the offer! Let's play with VirtualBox after we finish layouts :-)

Edward

Thomas Passin

unread,
Oct 14, 2024, 1:58:59 PM10/14/24
to leo-editor
D'accord. 

The good thing about using VirtualBox VMs is that you can try out many different distros and desktop managers without having to rework you computer each time. For example, I've learned that I dislike OpenSUSE and like EndeavourOS very much.  Also, you can create and restore from restore points very easily, so if you completely mess up your system or something goes wrong with a upgrade, you can roll back harmlessly and easily. And one last thing, it can be fairly easy to communicate between your Windows host and the Linux "guest" in several ways, although I suppose that WSL has made that easier.

Edward K. Ream

unread,
Oct 14, 2024, 6:01:18 PM10/14/24
to leo-editor

>> EKR: Iirc, LeoPyRef loads in approximately the same time on Windows 11 and Ubuntu.

Windows: about 2 sec.

Ubuntu: not likely much faster.

>> TBP: Much faster (1.35 vs 6.52 sec)

> One of life's mysteries. I'll check on Ubuntu later today.

I'm on Ubuntu now. Both leoPy.leo and LeoPyRef.leo load almost instantaneously.

Edward

Edward K. Ream

unread,
Oct 14, 2024, 6:54:26 PM10/14/24
to leo-editor
> - Installed Leo on wsl, but Leo does not work.

There is progress to report re Hyper-V services.

After upgrading to Windows Pro, Windows warned me that the memory integrity check could not be enabled because of several installed drivers(!) This was an important clue.

I used the device manager (using the "devices by driver" view) to remove four offending drivers. Two drivers remained because their descriptions did not include driver indices. Sheesh. But googling suggested this approach:

C:\Windows\System32>dir lv*.sys /s /b
C:\Windows\System32\drivers\lvrs64.sys
C:\Windows\System32\drivers\lvuvc64.sys

I deleted (by hand) the two offending drivers, and then rebooted.

I then enabled (set to automatic/triggered start) all Hyper-V services in the Services manager (tip: accessible via the Task manager). After a reboot, some Hyper-V services became active!

However, all this did not make Leo usable. Starting Leo from within wsl generated some new errors:

Failed to create wl_display (No such file or directory)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
WARNING: Some incorrect rendering might occur because the selected Vulkan device (Microsoft Direct3D12 (NVIDIA GeForce RTX 3080)) doesn't support base Zink requirements: feats.features.logicOp have_EXT_custom_border_color have_EXT_line_rasterization

Summary

Nothing now prevents Hyper-V services from running on my machine.

Qt continues to have serious problems when installed in wsl.

Edward

Thomas Passin

unread,
Oct 14, 2024, 7:19:55 PM10/14/24
to leo-editor
Possibly helpful:


If you get to a point and see a message about a missing xcb, like this:

Could not load the Qt platform plugin "xcb" ...

Here is some information I've collected about it:

Sometimes a new Leo install will not start.  The error message is something like this::

    qt.core.plugin.factoryloader: checking directory path "/usr/bin/platforms" ...
    qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""

    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

This could be because the Qt installer didn't install all of its libraries or they were installed but not into the standard location Qt expects.  This can be cured by exporting the right paths (may be different in different OSs)::

        QT_QPA_PLATFORM_PLUGIN_PATH= /usr/lib/qt6/plugins/platforms
        QT_PLUGIN_PATH= /usr/lib/qt6/plugins/platforms

If you have the ``locate`` command you can find the right location; e.g.::

   locate -r 'platforms$' |grep -i qt6
    /home/tom/.local/lib/python3.11/site-packages/PyQt6/Qt6/plugins/platforms

Otherwise use ``find``::

find / 2>/dev/null -type d -name platforms |grep -i 'qt6'
    /home/tom/.local/lib/python3.11/site-packages/PyQt6/Qt6/plugins/platforms


I don't know why the thing is complaining about Wayland. Wayland is a newer screen construction system, to replace the venerable X11.  Wayland is often trouble.  Ubuntu, or at least my install of 22.04/Cinnamon, is still using X11.  You can check with this command in a terminal:

echo $XDG_SESSION_TYPE

Edward K. Ream

unread,
Oct 14, 2024, 8:48:24 PM10/14/24
to leo-editor
On Monday, October 14, 2024 at 5:54:26 PM UTC-5 Edward K. Ream wrote:

> Nothing now prevents Hyper-V services from running on my machine.

Oh joy. SageMath (running on wsl) now opens plots correctly. Here is an example from the sage tutorial:

t = var('t')
P = parametric_plot((cos(2*t) + 2*cos(t), 4*cos(t) - cos(2*t) ),
    (t, 0, 2*pi), rgbcolor=hue(0.9))
show(P)

The show(P) statements opens a viewer window.  Hurray!

Edward

Edward K. Ream

unread,
Oct 15, 2024, 1:15:27 AM10/15/24
to leo-e...@googlegroups.com


On Mon, Oct 14, 2024 at 6:19 PM Thomas Passin <tbp1...@gmail.com> wrote:
Possibly helpful:


Thanks Thomas!

Edward

lewis

unread,
Oct 15, 2024, 6:35:54 AM10/15/24
to leo-editor
Edward,
I needed to install libxcb-cursor0 for both wsl Ubuntu 22.04 and wsl openSUSE-Tumbleweed.

Lewis

Edward K. Ream

unread,
Oct 15, 2024, 6:59:50 AM10/15/24
to leo-e...@googlegroups.com
On Tue, Oct 15, 2024 at 5:35 AM lewis <lewi...@fastmail.com.au> wrote:
Edward,
I needed to install libxcb-cursor0 for both wsl Ubuntu 22.04 and wsl openSUSE-Tumbleweed.

Thanks. That library has already been installed.

Edward

Thomas Passin

unread,
Oct 15, 2024, 8:51:41 AM10/15/24
to leo-editor
It could be a version mismatch, though.
Reply all
Reply to author
Forward
0 new messages