Ask Your Question

Build Error when Uploading Notebooks in Sage

asked 2017-08-07 17:12:08 +0200

AngelaH gravatar image

updated 2017-08-18 19:55:09 +0200

kcrisman gravatar image

Running Fedora 26 as a virtual machine, I recently installed Sage 8.0 from source (and was thrilled to see support for Jupiter....amazing!). Besides a minor error coming from Open SSL which I'll try to run down later, Sage seems to work perfectly, until I try to upload one or more zipped notebook files into the Sage Notebook. On screen, after uploading, I get a non descriptive "500:internal error" message. In the terminal, I get the message "Build Error:Could not build url for endpoint 'home' with values ['username']. Did you mean 'worksheet_listing.home' instead?" If the notebook is a new notebook (one which I didn't just download from Sage and reimport for diagnostic purposes) clicking on "continue" allows me to see and interact with the new notebooks. However, if I then exit Sage and restart it and the notebook, I get a 500:internal error in both the sage and jupiter notebooks and nothing else displayed (no link to "continue" to the notebooks or anything else). In the terminal I get a much longer error, which I've copied at the end of my message. Does anyone have any suggestions as to where to start trying to fix this? I've searched the forum, and not seen similar errors, but maybe I missed something. (I read that for a while Sage had import errors with files containing nonascii characters, so I'll add that I can recreate this behavior using a file called "Test" with the single line "1+1" contained in it, as well as using files exported from both a Sage 8.0 server and an older server I am still running.)

Any advice would be greatly appreciated!

(Longer error follows here:)

    [E 10:45:37.351 NotebookApp] Uncaught exception GET /sagenb?token=06fdd6ab20a2cd845ccc2c9a972faa770df9dcf12814aeb8 (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/sagenb?token=06fdd6ab20a2cd845ccc2c9a972faa770df9dcf12814aeb8', version='HTTP/1.1', remote_ip='::1', headers={'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip, deflate, br', 'Host': 'localhost:8888', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36', 'Connection': 'keep-alive', 'Cookie': '_xsrf=2|5673a5cc|62623cc6f31eb0ee368868cc418cc7ed|1501627626; sphinxsidebar=visible; username-localhost-8888="2|1:0|10:1502116964|23:username-localhost-8888|44:NDcxZTQ2OTQ1NmVhNDdiYTg4MjczZTJhNjQ3NmI5YWI=|2d1454b6f339bb26417cd7cf5b7b9c8149292440579ff0ec9e52ddf5ec225aa0"', 'Upgrade-Insecure-Requests': '1'})
    Traceback (most recent call last):
      File "/home/ashicks/Sage/sage-8.0/local/lib/python2.7/site-packages/tornado/", line 1443, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/home/ashicks/Sage/sage-8.0/local/lib/python2.7/site-packages/tornado/", line 2800, in wrapper
        return method(self, *args, **kwargs)
      File "/home/ashicks/Sage/sage-8.0/local/lib/python2.7/site-packages/sagenb_export/nbextension/", line 35, in get
      File "/home/ashicks/Sage/sage-8.0/local/lib/python2.7/site-packages/sagenb_export/nbextension/", line 22, in notebook_iter
        for notebook in NotebookSageNB.all_iter(dot_sage)
      File "/home/ashicks/Sage/sage-8.0/local/lib/python2.7/site-packages/sagenb_export/nbextension/", line 22, in <genexpr>
        for notebook in NotebookSageNB.all_iter(dot_sage)
      File "/home/ashicks/Sage/sage-8.0/local/lib/python2.7/site-packages/sagenb_export/", line 217, in sort_key
        return (self.conf['owner'], self.conf['id_number'])
    KeyError: 'owner'
[E 10:45:37.381 NotebookApp] {
      "Accept-Language": "en-US,en;q=0.8", 
      "Accept-Encoding": "gzip, deflate, br", 
      "Host": "localhost:8888", 
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", 
      "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36", 
      "Connection": "keep-alive", 
      "Cookie": "_xsrf=2|5673a5cc|62623cc6f31eb0ee368868cc418cc7ed|1501627626; sphinxsidebar=visible; username-localhost-8888=\"2|1:0|10:1502116964|23:username-localhost-8888|44:NDcxZTQ2OTQ1NmVhNDdiYTg4MjczZTJhNjQ3NmI5YWI=|2d1454b6f339bb26417cd7cf5b7b9c8149292440579ff0ec9e52ddf5ec225aa0\"", 
      "Upgrade-Insecure-Requests": "1"
[E 10:45:37.381 NotebookApp] 500 GET /sagenb?token=06fdd6ab20a2cd845ccc2c9a972faa770df9dcf12814aeb8 (::1) 37.04ms referer=None
edit retag flag offensive close merge delete


A useful piece of information may be that the "default" notebook in 8.0 is now a notebook exporter which allows you to export sagenb notebooks to Jupyter. But I don't recognize this particular error.

kcrisman gravatar imagekcrisman ( 2017-08-18 19:56:25 +0200 )edit

Thanks, I'm aware, and thanks for taking a look. I was hoping to import old notebooks from an old server, then export them to the Jupyter (as needed/wanted), but I've given up at this point. I'll add for the benefit of anyone in a similar situation in the future that I finally just manually copied the files containing my old notebooks into Sage notebook's standard location on the new server, just long enough to export them to Jupiter, as kcrisman suggests. This avoided the need for an "import", but wouldn't be a long term fix if I wanted to continue to use the old Sage notebook server, as copying files without "importing" them messes with Sage's counter of the number of created notebooks.

AngelaH gravatar imageAngelaH ( 2017-08-20 22:08:38 +0200 )edit

Hmm. You are right about this, of course. When you say "zipped", though, I have a couple questions. 1) Are you importing just .sws files or zipped collections thereof? 2) Are you importing through the "Notebook Exporter" or through the actual GUI of the sagenb? The latter shouldn't even be referencing NotebookApp, once started.

kcrisman gravatar imagekcrisman ( 2017-08-21 15:22:42 +0200 )edit

Importing a zipped collection in the GUI of sagenb triggers an "internal error" (the build error in the text above). Restarting sage AFTER the internal error and then running sage -n gets me to the Notebook Exporter, which is then inoperable with it's own "internal error" (and the big box of errors at the end of my post). The notebook exporter has been inoperable ever since (I had to use a different VM to hack my eventual export to Jupyter), but interestingly, I just realized that both the sagenb GUI and Jupyter start fine. So whatever internal error importing in the sagenb causes only is problematic when I run Notebook Exporter afterward. (Weird!) If others post with a similar error, I'll submit a bug report; for now, I'll move on out of respect for everyone's (volunteer) time. Thanks!

AngelaH gravatar imageAngelaH ( 2017-08-21 16:50:45 +0200 )edit

Yes, in fact you can do sage --notebook=sagenb, I think, to just run it without the exporter. My guess is that the exporter doesn't know how to deal with the upload signals from sagenb for the zip. Glad you have a workaround!

kcrisman gravatar imagekcrisman ( 2017-08-21 18:09:11 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-10-05 15:33:58 +0200

AngelaH gravatar image

It seems this is a current and reproducible bug. The report is here. Until this is fixed, it might not be wise to import .zip files in the sagenb gui if you intend to use the Notebook Exporter to convert them into Jupyter notebook files in Sage 8.0. (Although I have no idea how widespread the problem is, in my case the Notebook Exporter is not obviously recoverable, at least without a reinstallation.) Two workarounds are:

  1. If you intend to continue using sagenb, import files individually as .sws files
  2. Manually copy the old notebooks into the standard location for sage notebooks and then use the Notebook Exporter to move them to Jupyter. (Be careful not to create any new sage notebooks after the import, as the notebook "counter" will be off.)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-08-07 17:12:08 +0200

Seen: 723 times

Last updated: Oct 05 '17