[IPython-dev] kernel spect and how to thest them
Alessandro Dentella
sandro.dentella at gmail.com
Fri Feb 15 18:10:32 EST 2019
Hi,
I'd like to bettere understand "argv" list. It's the arguments passed
to what exactely? -m and --ext are for python/ipython, who interprets -f?
The setup
=========
I have a django project whit a std virtualenv with a working kernel
defined as follows:
{
"env": {
"DJANGO_SETTINGS_MODULE": "web.settings",
"PYTHONPATH": "$PYTHONPATH:/misc/src/hg/thunder/siti/alma/django" },
"argv": [
"/home/sandro/.virtualenvs/alma/bin/python3.6",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}",
"--ext",
"django_extensions.management.notebook_extension"
],
"display_name": "Alma ",
"language": "python"
}
>From a jupyter lab I can connect to that and it just works fine.
In my normal setup I use buildout that means I have an "empty"
vitualenv and a scipt that initializes the sys.path. So I tried to
modify the configuration as follows:
{
"env": {
"DJANGO_SETTINGS_MODULE": "web.settings",
"PYTHONPATH": "$PYTHONPATH:/misc/src/hg/thunder/siti/alma/django/env" },
"argv": [
"/home/sandro/.virtualenvs/alma/bin/python3.6",
"-m",
"setup_jupyter",
"-f",
"{connection_file}",
"--ext",
"django_extensions.management.notebook_extension"
],
"display_name": "Alma 2",
"language": "python"
}
Where setup_jupiter is in PYTHONPATH and uses site.addsitedir():
import os
import site
site.addsitedir(os.path.dirname(__file__))
import ipykernel_launcher
Question
========
But this modified kernel spec does not work (sys.path it's correclty
setup due to a custom path.pth)
Jupiter lab (run in a different virtualenv) complains:
[I 20:07:27.618 LabApp] Kernel started: 11cc7c35-b88b-4f87-ad42-bdf85f28c352
[I 20:07:28.230 LabApp] KernelRestarter: restarting kernel (2/5), new random ports
[I 20:07:31.236 LabApp] KernelRestarter: restarting kernel (3/5), new random ports
[I 20:07:34.244 LabApp] KernelRestarter: restarting kernel (4/5), new random ports
[W 20:07:37.249 LabApp] KernelRestarter: restart failed
How can I debug what's wrong and particularly is there a way to start
that particular kernel, based on those kernel spec alone?
Sandro
More information about the IPython-dev
mailing list