1

I have a custom Jupyter kernel. It is specified using a kernel.json kernelspec.

An extract from kernel.json shows how to start the custom kernel:

source /opt/conda/bin/activate gdb_ipykernel &&  exec /opt/conda/envs/gdb_ipykernel/bin/python -m gdb_test.do_tests gdb_test._ipykernel -f {connection_file}

I would like to use this kernel with IPython-parallel. For example running ipcluster with several of these custom kernels.

I have created a new IPython profile

(ipython version 5.1.0)

ipython profile create --parallel --profile=gdb_gcc_par

This creates a profile folder with various configuration (.py) files.

db              ipcluster_config.py     ipengine_config.py     ipython_config.py         log  security
history.sqlite  ipcontroller_config.py  ipython_config_old.py  ipython_kernel_config.py  pid  startup

I can run ipython with a profile

ipython --profile gdb_gcc_par --debug

Output:

(root) dinne@654f3bb1ef03:~/.ipython/profile_gdb_gcc_par$ ipython --profile gdb_gcc_par --debug
[TerminalIPythonApp] IPYTHONDIR set to: /home/dinne/.ipython
[TerminalIPythonApp] Using existing profile dir: '/home/dinne/.ipython/profile_gdb_gcc_par'
[TerminalIPythonApp] Searching path ['/home/dinne/.ipython/profile_gdb_gcc_par', '/home/dinne/.ipython/profile_gdb_gcc_par', '/usr/local/etc/ipy
thon', '/etc/ipython'] for config files
[TerminalIPythonApp] Attempting to load config file: ipython_config.py
[TerminalIPythonApp] Looking for ipython_config in /etc/ipython
[TerminalIPythonApp] Looking for ipython_config in /usr/local/etc/ipython
[TerminalIPythonApp] Looking for ipython_config in /home/dinne/.ipython/profile_gdb_gcc_par
[TerminalIPythonApp] Loaded config file: /home/dinne/.ipython/profile_gdb_gcc_par/ipython_config.py
[TerminalIPythonApp] Looking for ipython_config in /home/dinne/.ipython/profile_gdb_gcc_par
[TerminalIPythonApp] Loaded config file: /home/dinne/.ipython/profile_gdb_gcc_par/ipython_config.py
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:53:06)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- 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: gdb_gcc_par

[TerminalIPythonApp] Loading IPython extensions...
[TerminalIPythonApp] Loading IPython extension: storemagic
[TerminalIPythonApp] Starting IPython's mainloop...

In [1]:

If I introduce an error in ipython_config.py I see an error message, so I conclude that this configuration file is taken into account.

If I introduce an error in ipython_kernel_config.py I do not see any change, so I conclude that this configuration file is not taken into account?

How can I specify which kernel to use?

I found this site:

http://andrew.gibiansky.com/blog/ipython/ipython-kernels/

which includes this snippet:

c = get_config()
c.KernelManager.kernel_cmd = ["/path/to/executable/kernel_exe",
                              "{connection_file}"]  

I added the snippet to ipython_config.py. This has no effect however.

Furthermore I see that kernel_cmd is deprecated

Some things I tried:

Try 1 (No effect)

ipcluster start --n=4 --KernelManager.kernel_cmd="['python', 'simple_kernel.py', '{con
nection_file}']"

Try 2 (no effect):

added to ~/.ipython/profile_gdb_gcc_par/ipython_config.py

c.KernelManager.kernel_cmd=['python', 'simple_kernel.py', '{connection_file}']

run

ipython --profile gdb_gcc_par

no effect.

dwjbosman
  • 906
  • 9
  • 33

0 Answers0