Importing PyQ from within Spyder causes kernel to die

197 views Asked by At

Have installed kdb+ 64-bit to a Windows 10 machine.

Running within Anaconda/Spyder, when I import PyQ, I get an error message that the kernel died. No issues running q stand alone from the command line.

Both of these

import pyq

from pyq import q

Give this error, along with a kernel restart.

Kernel died, restarting

version info:

Spyder 3.3.1

Python 3.6

kdb+/q 3.6 (64-bit)

Any ideas how to resolve this?

1

There are 1 answers

1
Alexander Belopolsky On

You cannot import pyq into a regular python session, but you should be able to connect Spyder to a pyq kernel. First, install pyq-kernel:

pip install pyq-kernel
pyq -m pyq.kernel install

Second, start a pyq kernel session on the console and find the kernel id:

$ jupyter console --kernel=pyq_3

In [2]: %connect_info
{
  "shell_port": 60484,
  "iopub_port": 60485,
  "stdin_port": 60486,
  "control_port": 60487,
  "hb_port": 60488,
  "ip": "127.0.0.1",
  "key": "ca3c4bc5-a55c552fdb14da48fda44b9d",
  "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-25218.json
or even just:
    $> jupyter <app> --existing
if this is the most recent Jupyter kernel you have started.

Kernel id is the number in the `kernel-###.json file.

Finally, go the menu under the gear icon in the Spyder's IPython console window, select "Connect to an existing kernel" and enter the kernel id that you have found in the second step in the "Kernel ID/Connection file" box.