Ask Your Question

How to attach a simple Sage script in a Sage Jupyter notebook

asked 2018-10-16 14:31:13 +0200

Jozef gravatar image

My two PCs' configurations: Windows 8.1, Windows 10
Sage version: SageMath 8.3, windows installer 0.4

I want to use a Sage script in a Sage Jupyter Notebook (Jupyter with Sage as a kernel).

I have tried the following procedure:

  1. I put a Sage code (definition of a function) in text file named Script.sage.
  2. In a Jupyter notebook I tried command attach('Script.Sage')
  3. I got a usage error: UsageError: Invalid GUI request 'sage', valid ones are:[None, 'widget', 'qt5', 'qt', 'nbagg', 'osx', 'gtk', 'qt4', 'gtk3', 'notebook', 'tk', 'ipympl', 'inline', 'asyncio', 'wx']

Some advice about where is a problem? What to do? Or is there another procedure how to use a Sage code written in separate files in a Jupyter notebook?

edit retag flag offensive close merge delete


The issue you're getting with attach() looks like a bit of a bug though. I don't think it's particular to Windows either. Even if it is "expected" from a coding perspective it is certainly unexected and unhelpful from a user perspective.

Iguananaut gravatar imageIguananaut ( 2018-11-02 18:53:53 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-10-16 18:10:59 +0200

tmonteil gravatar image

I am not running windows, so i can not test, but the following works on GNU/Linux:


It is not attached, meaning that when you modify the file, you will have to reload it manually to take changes into account.

edit flag offensive delete link more


Thank you. The command load works in Windows as you described for Linux. It is sufficient for my purposes.

Jozef gravatar imageJozef ( 2018-10-18 16:26:56 +0200 )edit

Can anyone explain why load works and attach doesn't?

dantetante gravatar imagedantetante ( 2022-04-05 19:49:49 +0200 )edit

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: 2018-10-16 14:31:13 +0200

Seen: 850 times

Last updated: Oct 16 '18