[IPython-dev] Stand-alone kernel uses wrong kernel?

Doug Blank doug.blank at gmail.com
Sat Feb 22 11:28:25 EST 2014


On Sat, Feb 22, 2014 at 11:11 AM, Thomas Kluyver <takowl at gmail.com> wrote:

> 'ipython kernel' is the command to start an IPython kernel. It's not a
> wrapper around a kernel process, it is a kernel process. To start your own
> kernel, run whatever command you put in kernel_cmd.
>
Well, that is not quite the whole story, because something needs to create
the JSON file to pass to the command that you put in kernel_cmd, right?

Wouldn't it just be easier if "ipython kernel" used the kernel_cmd from the
profile given, and spawned a kernel process if necessary, in the case of
external kernels? Then it would be exactly symmetric to the rest of the
subcommands. Is there a specific reason it doesn't? (Otherwise, all of the
other kernels will have to replicate this exact functionality).

-Doug


> Thomas
> On 22 Feb 2014 05:52, "Doug Blank" <doug.blank at gmail.com> wrote:
>
>> Bug or user error? If I start up a stand-alone kernel with latest
>> IPython-master 2.0.0-dev like so:
>>
>> """
>> $ ipython kernel --profile calico
>> NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.
>>
>> To exit, you will have to explicitly quit this process, by either sending
>> "quit" from a client, or using Ctrl-\ in UNIX-like environments.
>>
>> To read more about this, see
>> https://github.com/ipython/ipython/issues/2049
>>
>> To connect another client to this kernel, use:
>>     --existing kernel-20283.json --profile calico
>> """
>>
>> And then attempt to connect onto it with any frontend:
>>
>> """
>> $ ipython console --existing kernel-20283.json --profile calico
>> Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
>> Type "copyright", "credits" or "license" for more information.
>>
>> IPython 2.0.0-dev -- An enhanced Interactive Python.
>> ?         -> Introduction and overview of IPython's features.
>> %quickref -> Quick reference.
>> help      -> Python's own help system.
>> object?   -> Details about 'object', use 'object??' for extra details.
>>
>> IPython profile: calico
>>
>> In [1]: calico
>>
>> ---------------------------------------------------------------------------
>> NameError                                 Traceback (most recent call
>> last)
>> <ipython-input-1-c2029787b47e> in <module>()
>> ----> 1 calico
>>
>> NameError: name 'calico' is not defined
>> """
>>
>> As can be seen, it is not using the Calico kernel. Everything else seems
>> to work great with this config/profile.
>>
>> """
>> $ ipython console --profile calico
>> Loading Calico version 2.5.0...
>> Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
>> Type "copyright", "credits" or "license" for more information.
>>
>> IPython 2.0.0-dev -- An enhanced Interactive Python.
>> ?         -> Introduction and overview of IPython's features.
>> %quickref -> Quick reference.
>> help      -> Python's own help system.
>> object?   -> Details about 'object', use 'object??' for extra details.
>>
>> IPython profile: calico
>>
>> In [1]: calico
>> Out[1]: <Calico instance, version 2.5.0>
>> """
>>
>> I have just edited the one ipython_config.py as follows:
>>
>> """
>> $ ls -al ~/.ipython/profile_calico/
>> total 136
>> drwxr-xr-x 8 dblank dblank  4096 Feb 22 08:35 .
>> drwxr-xr-x 6 dblank dblank  4096 Feb 21 09:46 ..
>> drwxr-xr-x 2 dblank dblank  4096 Feb 21 09:46 db
>> -rw-r--r-- 1 dblank dblank  9216 Feb 22 08:35 history.sqlite
>> -rw-r--r-- 1 dblank dblank   485 Feb 21 13:55 ipython_config.py
>> -rw-r--r-- 1 dblank dblank 31535 Feb 21 10:18 ipython_nbconvert_config.py
>> -rw-r--r-- 1 dblank dblank 23317 Feb 21 10:18 ipython_notebook_config.py
>> -rw-r--r-- 1 dblank dblank 24577 Feb 21 10:18 ipython_qtconsole_config.py
>> drwxr-xr-x 2 dblank dblank  4096 Feb 21 09:46 log
>> drwx------ 2 dblank dblank  4096 Feb 21 09:46 pid
>> drwx------ 2 dblank dblank  4096 Feb 22 08:34 security
>> drwxr-xr-x 2 dblank dblank  4096 Feb 21 13:55 startup
>> drwxr-xr-x 3 dblank dblank  4096 Feb 21 09:46 static
>> dblank at vaio:~/Calico$ cat ~/.ipython/profile_calico/ipython_config.py
>> # Configuration file for ipython.
>>
>> c = get_config()
>> c.KernelManager.kernel_cmd = [
>>       'mono', '/home/dblank/Calico/bin/Calico.exe',
>>      '--server', '{connection_file}']
>> """
>>
>> And the JSON connection file looks fine:
>>
>> """
>> $ cat ~/.ipython/profile_calico/security/kernel-20283.json
>>  {
>>   "stdin_port": 56854,
>>   "ip": "127.0.0.1",
>>   "control_port": 50139,
>>   "hb_port": 35067,
>>   "signature_scheme": "hmac-sha256",
>>   "key": "...",
>>   "shell_port": 59556,
>>   "transport": "tcp",
>>   "iopub_port": 52203
>> }
>> """
>>
>> Am I using the kernel subcommand incorrectly, or just that there is a bug
>> in selecting the kernel?
>>
>> -Doug
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140222/30077524/attachment.html>


More information about the IPython-dev mailing list