SageMath notebook on Fedora 30

When I try to load “notebook()” from a terminal running sage, I get the following error"

sage: notebook()
/usr/lib/python3.7/site-packages/werkzeug/datastructures.py:16: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Container, Iterable, MutableSet
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-b5959bb24428> in <module>()
----> 1 notebook()

/usr/lib64/python3.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3648)()
    352             True
    353         """
--> 354         return self.get_object()(*args, **kwds)
    355 
    356     def __repr__(self):

/usr/lib64/python3.7/site-packages/sagenb/notebook/notebook_object.py in __call__(self, *args, **kwds)
    241     """
    242     def __call__(self, *args, **kwds):
--> 243         return self.notebook(*args, **kwds)
    244 
    245     notebook = run_notebook.notebook_run

/usr/lib64/python3.7/site-packages/sagenb/notebook/run_notebook.py in notebook_run(self, directory, port, interface, port_tries, secure, reset, accounts, openid, server_pool, ulimit, timeout, doc_timeout, upload, automatic_login, start_path, fork, quiet, server, profile, subnets, require_login, open_viewer, address)
    532     # if none use defaults
    533 
--> 534     nb = notebook.load_notebook(directory)
    535 
    536     directory = nb._dir

/usr/lib64/python3.7/site-packages/sagenb/notebook/notebook.py in load_notebook(dir, interface, port, secure, user_manager)
   1837 
   1838     dir = make_path_relative(dir)
-> 1839     nb = Notebook(dir)
   1840     nb.interface = interface
   1841     nb.port = port

/usr/lib64/python3.7/site-packages/sagenb/notebook/notebook.py in __init__(self, dir, user_manager)
    159         # Set up email notification logger
    160         import logging
--> 161         from sagenb.notebook.notification import logger, TwistedEmailHandler
    162         logger.addHandler(TwistedEmailHandler(self.conf(), logging.ERROR))
    163         # also log to stderr

/usr/lib64/python3.7/site-packages/sagenb/notebook/notification.py in <module>()
      2 import logging
      3 from .sage_email import default_email_address
----> 4 from .smtpsend import send_mail
      5 from socket import getfqdn
      6 

/usr/lib64/python3.7/site-packages/sagenb/notebook/smtpsend.py in <module>()
     19 Bobby Moretti
     20 """
---> 21 from twisted.mail import smtp, relaymanager  # problematic with python 3
     22 from email.mime.base import MIMEBase
     23 from email.mime.multipart import MIMEMultipart

ImportError: cannot import name 'relaymanager' from 'twisted.mail' (unknown location)
sage:

Hello. I have several questions:

  • Did you just upgrade and did you enabled --allowerasing by any chance?
  • Did you have your program installed before upgrading or did you just installed it?
  • Did you install your program using dnf?
  • If you check for the twisted package in your system, is it installed and what version? (Hint: You can use the command rpm -qa | grep twisted to see if it’s installed.
1 Like

I just did a complete load, because I screwed up Fedora 29 and
figured it was easier to just start over.

Both, but the system I’m using is one I just installed.

No. I used a disc with ban ISO image.

rpm -qa | grep twisted
python3-twisted-19.2.0-1.fc30.x86_64

Is SageMath working now that you fresh-installed Fedora?

1 Like

No it is not working. The fedora 30 is newly installed.

You said this, you meant you installed your program using an ISO image or the Fedora upgrade?

Also, can you list the steps to reproduce your problem so I can briefly test this on my machine? Start from the installation, please.

1 Like

Yes. I used an ISO image.

I opened a terminal, typed in sage. When I got the sage prompt, I typed in ‘notebook()’

    /usr/lib/python3.7/site-packages/werkzeug/datastructures.py:16: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Container, Iterable, MutableSet
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-b5959bb24428> in <module>()
----> 1 notebook()

/usr/lib64/python3.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3648)()
    352             True
    353         """
--> 354         return self.get_object()(*args, **kwds)
    355 
    356     def __repr__(self):

/usr/lib64/python3.7/site-packages/sagenb/notebook/notebook_object.py in __call__(self, *args, **kwds)
    241     """
    242     def __call__(self, *args, **kwds):
--> 243         return self.notebook(*args, **kwds)
    244 
    245     notebook = run_notebook.notebook_run

/usr/lib64/python3.7/site-packages/sagenb/notebook/run_notebook.py in notebook_run(self, directory, port, interface, port_tries, secure, reset, accounts, openid, server_pool, ulimit, timeout, doc_timeout, upload, automatic_login, start_path, fork, quiet, server, profile, subnets, require_login, open_viewer, address)
    532     # if none use defaults
    533 
--> 534     nb = notebook.load_notebook(directory)
    535 
    536     directory = nb._dir

/usr/lib64/python3.7/site-packages/sagenb/notebook/notebook.py in load_notebook(dir, interface, port, secure, user_manager)
   1837 
   1838     dir = make_path_relative(dir)
-> 1839     nb = Notebook(dir)
   1840     nb.interface = interface
   1841     nb.port = port

/usr/lib64/python3.7/site-packages/sagenb/notebook/notebook.py in __init__(self, dir, user_manager)
    159         # Set up email notification logger
    160         import logging
--> 161         from sagenb.notebook.notification import logger, TwistedEmailHandler
    162         logger.addHandler(TwistedEmailHandler(self.conf(), logging.ERROR))
    163         # also log to stderr

/usr/lib64/python3.7/site-packages/sagenb/notebook/notification.py in <module>()
      2 import logging
      3 from .sage_email import default_email_address
----> 4 from .smtpsend import send_mail
      5 from socket import getfqdn
      6 

/usr/lib64/python3.7/site-packages/sagenb/notebook/smtpsend.py in <module>()
     19 Bobby Moretti
     20 """
---> 21 from twisted.mail import smtp, relaymanager  # problematic with python 3
     22 from email.mime.base import MIMEBase
     23 from email.mime.multipart import MIMEMultipart

ImportError: cannot import name 'relaymanager' from 'twisted.mail' (unknown location)

Have you tried installing it with dnf instead of an ISO image? A dnf search sagemath lists that the program is available in the repositories. A sudo dnf install sagemath will do. I’d try to install it myself to check it out, but my Internet is crap and it will take forever to download and install. It’s an 845 MB install.

1 Like

I just finished

dnf remove sagemath
dnf install sagemath

but I still get the same errors.

Reinstalling is not really going to help anything. This is a bug in sagemath that was switched to Python 3, but some of its dependencies are not fully available yet. (It’s a bit unfortunate that it’s for some sort of email notification thing that I’m sure you probably don’t need.)

Please report a bug about this so that the maintainer can be made aware of the issue.

2 Likes

I downloaded sagemath 8.7 and compiled it. It works fine now. Thanks to all who offered advice.