Ask Your Question

%attach/attach() does not work in sage jupyter (sage 7.5.1)

asked 2017-01-23 06:37:18 -0500

notabot gravatar image

Whenever I open a jupyter notebook in Sage 7.5.1 (sage -n jupyter), issuing a magic command


or an inline attachcommand


results in an error:

UsageError: Invalid GUI request 'sage', valid ones are:['osx', 'qt4', 'qt5', 'nbagg', None, 'gtk', 'gtk3', 'notebook', 'tk', 'inline', 'wx', 'qt']

I found this error in sagemath 7.5.1, but it is not present in sagemath 7.2. The magic %load, however, works.

Any workarounds? (besides changing %attach to %load, I mean.)

edit retag flag offensive close merge delete



Upon further searching, I found that in file /Applications/ there is a registered input hook: register('sage', sage_inputhook). It seems that the 'sage' GUI has no support for attaching files?

notabot gravatar imagenotabot ( 2017-01-23 07:41:22 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2017-01-24 05:05:29 -0500

notabot gravatar image

Since the answer is “Any workarounds?”, I'll document the one workaround that I found. However, the original problem persists; so I think that a bug report is due.

The workaround is to replace




Note that this workaround looses the automatic reloading feature; which is the point of attach in the first place. But at the very least, I can now load code and data from files.

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-01-23 06:32:59 -0500

Seen: 53 times

Last updated: Jan 24