KxSystems / pyq

PyQ — Python for kdb+
http://code.kx.com/q/interfaces
Apache License 2.0
190 stars 49 forks source link

'Kernel died, restarting' error when importing pyq in Anaconda #103

Closed cppt closed 5 years ago

cppt commented 5 years ago

Posting a bug report per suggestion on SO.

Questions

Win10 64-bit

pyq version 4.1.4

64-bit kdb+

No QLIC variable set

No, installed directly

No, primarily pip

Steps to reproduce the issue

import pyq

OR

from pyq import q

Expected result

Package imported successfully (no return within Spyder)

Actual result

from pyq import q

Kernel died, restarting

Workaround

NA

sashkab commented 5 years ago

Your bug report is confusing and not full.

Title says "'Kernel died, restarting' error when importing pyq in Anaconda", but in the issue description you say that "No, primarily pip".

Are you using notebooks? If so, please provide detailed answers to the questions in descriptions. What version of the PyQ kernel are you using?

abalkin commented 5 years ago

I am not familiar with the Spyder, but I assume the "Kernel died, ..." message comes from the Spyder backend. Unless you somehow reconfigured it to start "q python.q", it runs regular python and importing pyq in regular python is not supported.

cppt commented 5 years ago

Spyder is a Python IDE.  The error messages displays within the console/ipython command line when running the import.  Do you have suggestions on integrating it with python programs in that case?

abalkin commented 5 years ago

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.