Sage ImportError: canot load Singular library

342 views
Skip to first unread message

Jaco Van Tonder

unread,
May 11, 2022, 6:23:15 AM5/11/22
to sage-support
I am running Fedora 36 (had the same issue in Fedora 35) on a Lenovo IdeaPad. After installing sage using dnf I tried running it but it failed due to: "ImportError: cannot load Singular library from libSingular.so (b'libSingular.so: cannot open shared object file: No such file or directory')". The full error report is:

Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib64/python3.10/pathlib.py", line 1303, in is_dir
    return S_ISDIR(self.stat().st_mode)
AttributeError: 'str' object has no attribute 'stat'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib64/sagemath/local/bin/sage-ipython", line 15, in <module>
    app.initialize()
  File "/home/jacovantonder/.local/lib/python3.10/site-packages/traitlets/config/application.py", line 88, in inner
    return method(app, *args, **kwargs)
  File "/usr/lib/python3.10/site-packages/IPython/terminal/ipapp.py", line 276, in initialize
    self.init_shell()
  File "/usr/lib64/python3.10/site-packages/sage/repl/interpreter.py", line 789, in init_shell
    self.shell.extension_manager.load_extension(SAGE_EXTENSION)
  File "/usr/lib/python3.10/site-packages/IPython/core/extensions.py", line 76, in load_extension
    return self._load_extension(module_str)
  File "/usr/lib/python3.10/site-packages/IPython/core/extensions.py", line 99, in _load_extension
    if self._call_load_ipython_extension(mod):
  File "/usr/lib/python3.10/site-packages/IPython/core/extensions.py", line 151, in _call_load_ipython_extension
    mod.load_ipython_extension(self.shell)
  File "/usr/lib64/python3.10/site-packages/sage/repl/__init__.py", line 5, in load_ipython_extension
    sage.repl.ipython_extension.load_ipython_extension(*args)
  File "/usr/lib64/python3.10/site-packages/sage/repl/ipython_extension.py", line 617, in wrapper
    result = func(*args, **kwargs)
  File "/usr/lib64/python3.10/site-packages/sage/repl/ipython_extension.py", line 630, in load_ipython_extension
    SageCustomizations(shell=ip)
  File "/usr/lib64/python3.10/site-packages/sage/repl/ipython_extension.py", line 434, in __init__
    import sage.all # until sage's import hell is fixed
  File "/usr/lib64/python3.10/site-packages/sage/all.py", line 131, in <module>
    from sage.rings.all      import *
  File "/usr/lib64/python3.10/site-packages/sage/rings/all.py", line 87, in <module>
    from .qqbar import (AlgebraicRealField, AA,
  File "/usr/lib64/python3.10/site-packages/sage/rings/qqbar.py", line 2810, in <module>
    QQxy = QQ['x', 'y']
  File "sage/structure/parent.pyx", line 1276, in sage.structure.parent.Parent.__getitem__
  File "/usr/lib64/python3.10/site-packages/sage/categories/rings.py", line 1177, in __getitem__
    return PolynomialRing(self, elts)
  File "/usr/lib64/python3.10/site-packages/sage/rings/polynomial/polynomial_ring_constructor.py", line 647, in PolynomialRing
    return _multi_variate(base_ring, names, **kwds)
  File "/usr/lib64/python3.10/site-packages/sage/rings/polynomial/polynomial_ring_constructor.py", line 775, in _multi_variate
    from sage.rings.polynomial.multi_polynomial_libsingular import MPolynomialRing_libsingular
  File "sage/rings/polynomial/multi_polynomial_libsingular.pyx", line 1, in init sage.rings.polynomial.multi_polynomial_libsingular
  File "sage/libs/singular/singular.pyx", line 1558, in init sage.libs.singular.singular
  File "sage/libs/singular/singular.pyx", line 1532, in sage.libs.singular.singular.init_libsingular
ImportError: cannot load Singular library from libSingular.so (b'libSingular.so: cannot open shared object file: No such file or directory')

I've had issues with installing sage with conda as well. Not being able to get the kernel to connect in Jupyter.

Vegard Lima

unread,
May 11, 2022, 7:21:51 AM5/11/22
to sage-s...@googlegroups.com
Hi,

what does this command say?
$ rpm -q Singular-libs
On fedora 35 I get:
Singular-libs-4.2.0p3-1.fc35.x86_64

And my output from this
$ ldd /usr/lib64/python3.10/site-packages/sage/libs/singular/singular.cpython*
contains a line
libSingular-4.2.0.so =>
/usr/lib64/sagemath/local/lib/libSingular-4.2.0.so
(0x00007f7cc833b000)

Does singular.console() work (or maybe sage doesn't start from the
console at all?)
sage: singular_console()

Cheers,
Vegard
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/8a951d19-0cbc-451a-92a7-553acb352b51n%40googlegroups.com.

Matthias Koeppe

unread,
May 11, 2022, 1:10:30 PM5/11/22
to sage-support
Report Fedora packaging bugs to Fedora

Francesco Buscemi

unread,
Jun 2, 2022, 3:36:50 AM6/2/22
to sage-support
Hello there; any news? I'm getting exactly the same errors...

Vegard Lima

unread,
Jun 10, 2022, 5:41:59 AM6/10/22
to sage-s...@googlegroups.com
Hi,

there should be a fix for this in updates-testing for Fedora 36:
$ sudo dnf update sagemath --enablerepo=updates-testing

You might have to do this first:
$ sudo dnf erase sagemath-doc-en

Cheers,
Vegard
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/c436992f-2358-401c-94b0-c7ed4d434f20n%40googlegroups.com.
Message has been deleted

Dima Pasechnik

unread,
Jun 10, 2022, 7:55:28 AM6/10/22
to sage-support
On Fri, Jun 10, 2022 at 12:50 PM 'Alan Stafford' via sage-support
<sage-s...@googlegroups.com> wrote:
>
> sudo cd /
> sudo rm -r *.*

I don't think this is an appropriate joke to post here.

We might have to start screening your posts...

Dima
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CADhtfW2OpOS%2BqF_WVrBLJbJFcyyyCYFRPu4cHRBq990XzdjsQw%40mail.gmail.com.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/1181715023.1919397.1654861804494%40mail.yahoo.com.

Jaco Van Tonder

unread,
Jun 13, 2022, 10:30:03 PM6/13/22
to sage-support
Hi Vegard,
This fixes the Singular library load problem but I now have another problem. When I try to load the sage kernel on Jupyter Lab it can't connect:

[I 2022-06-14 12:24:36.977 ServerApp] Kernel started: 7081cbfd-e5e1-4168-b1e4-cac56170523f
/home/jacovantonder/anaconda3/bin/python3: Error while finding module specification for 'sage.repl.ipython_kernel' (ModuleNotFoundError: No module named 'sage')
[I 2022-06-14 12:24:39.978 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), new random ports
/home/jacovantonder/anaconda3/bin/python3: Error while finding module specification for 'sage.repl.ipython_kernel' (ModuleNotFoundError: No module named 'sage')
[I 2022-06-14 12:24:42.989 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (2/5), new random ports
/home/jacovantonder/anaconda3/bin/python3: Error while finding module specification for 'sage.repl.ipython_kernel' (ModuleNotFoundError: No module named 'sage')
[I 2022-06-14 12:24:46.000 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (3/5), new random ports
/home/jacovantonder/anaconda3/bin/python3: Error while finding module specification for 'sage.repl.ipython_kernel' (ModuleNotFoundError: No module named 'sage')
[I 2022-06-14 12:24:49.008 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (4/5), new random ports
/home/jacovantonder/anaconda3/bin/python3: Error while finding module specification for 'sage.repl.ipython_kernel' (ModuleNotFoundError: No module named 'sage')
[W 2022-06-14 12:24:49.285 ServerApp] 404 GET /api/kernels/ed469bfa-69f5-4462-9fc6-ac5089e55f07?1655173488778 (127.0.0.1): Kernel does not exist: ed469bfa-69f5-4462-9fc6-ac5089e55f07
[W 2022-06-14 12:24:49.286 ServerApp] Kernel does not exist: ed469bfa-69f5-4462-9fc6-ac5089e55f07
[W 2022-06-14 12:24:49.286 ServerApp] 404 GET /api/kernels/ed469bfa-69f5-4462-9fc6-ac5089e55f07?1655173488778 (127.0.0.1) 1.81ms referer=http://localhost:8888/lab/tree/%E3%83%89%E3%82%AD%E3%83%A5%E3%83%A1%E3%83%B3%E3%83%88/Brilliant/Neural%20Networks/Untitled.ipynb
[W 2022-06-14 12:24:52.020 ServerApp] AsyncIOLoopKernelRestarter: restart failed
[W 2022-06-14 12:24:52.020 ServerApp] Kernel 7081cbfd-e5e1-4168-b1e4-cac56170523f died, removing from map.

Vegard Lima

unread,
Jun 14, 2022, 8:19:32 AM6/14/22
to sage-s...@googlegroups.com
Hi,

On Tue, Jun 14, 2022 at 4:30 AM Jaco Van Tonder
<jacovant...@gmail.com> wrote:
> This fixes the Singular library load problem but I now have another problem. When I try to load the sage kernel on Jupyter Lab it can't connect:
>
> [I 2022-06-14 12:24:36.977 ServerApp] Kernel started: 7081cbfd-e5e1-4168-b1e4-cac56170523f
> /home/jacovantonder/anaconda3/bin/python3: Error while finding module specification for 'sage.repl.ipython_kernel' (ModuleNotFoundError: No module named 'sage')

My guess would be that anaconda's python3 cannot see
the system installation of the sage packages.

I've only used jupyter-notebook from the "python3-notebook" fedora package.
Have not tried Jupyter Lab, but maybe this could be useful:
https://www.redhat.com/sysadmin/install-jupyterlab-linux

Cheers,
--
Vegard
Reply all
Reply to author
Forward
0 new messages