How to set up Jupyter qtconsole to run Sagemath

asked 2021-12-24 02:15:39 +0100

whiffee gravatar image

Hi All,

I have a Sagemath 9.4 folder and it tests good on XFCE console on Xubuntu 21.10. I also have Jupyter qtconsole 5.0.2-2 installed. I want to run Sagemath on qtconsole. If I run

./sage -n ipython

in XFCE it throws me into Firefox to a mirror view of the Sage folder. Under the 'Running' tab is the msg

No terminals are running.

But at this point a (useless) ipython console is running from the point of view of qtconsole. So if in a separate terminal I open qtconsole and run

%connect_info

I get

{
  "shell_port": 57411,
  "iopub_port": 55751,
  "stdin_port": 37633,
  "control_port": 49559,
  "hb_port": 59669,
  "ip": "127.0.0.1",
  "key": "5b9cb610-7062b32ac0e643c16b7c17f7",
  "transport": "tcp",
  "signature_scheme": "hmac-sha256",
  "kernel_name": ""
}

Paste the above JSON into a file, and connect with:
     jupyter [app] --existing [file]
or, if you are local, you can connect with just:
     jupyter [app] --existing kernel-4868.json
or even just:
     jupyter [app] --existing
if this is the most recent Jupyter kernel you have started.

So this seems to give me way. So now if I open a second instance of qtconsole with

Jupyter qtconsole --existing kernel-4868.json

it opens a qtconsole which looks ready to go. However, Sagemath is not in there because it is not displaying a Sagemath prompt. If I had to guess, I would say that the blank field where "kernel_name" should go above is telling me that I need to register the Sagemath kernel with Jupyter. I have a

export SAGE_ROOT="..."

line in .bashrc, but this is not working. What would I need to do to get Sagemath properly recognized by qtconsole (or vice versa) ? (Preferably without Anaconda or Pip.)

edit retag flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your question.

slelievre gravatar imageslelievre ( 2021-12-24 20:12:45 +0100 )edit