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.