1

Any guesses on how to specify a specific ipython config from qtconsole?

Without qtconsole:

ipython --profile=my_profile_name

Where my_profile_name is a profile name under your global ipython directory, for ipython kernel options. This lets you specify ipython-specific things, like modules to import on load.

With qtconsole:

jupyter console --config=/./jupyter_qtconsole_config.py

Where you can specify a specific config file to setup general non-ipython-specific qtconsole settings, like font size.

How can you specify set the ipython profile (ideally point it to a file, but may be limited to specifying a global profile name) from qtconsole? ie add the ---profile tag to jupyter qtconsole? Im this link: https://groups.google.com/forum/#!topic/jupyter/kzEws9ZeCFE Matthias mentions specifying a kernel, but that seems overkill.

You can specify profile in a file called 'ipython_kernel_config.py'; perhaps the solution lies in launching qtconsole with --config=jupyter_qtconsole_config.py, and pointing in this file to a custom ipython_kernel_config.py that points to a profile name; not sure how to point to the kernel config file, and no obvious way in the jupyter config docs.

Turtles Are Cute
  • 3,200
  • 6
  • 30
  • 38

1 Answers1

2

You need to create a custom kernelspec and launch the qtconsole for this specific kernel.

Usually a "kernel" is seen as a language; this is an extremely restrictive view of what a kernel is. In your case what you want to do is have multipel IPython kernels, each launching IPython with a different profile. Here is the more formal definition of what a kernelspec is; but roughly it describe how to start a process.

By using jupyter kernelspec list, I can see I have a Python kernelspec in /usr/local/share/jupyter/kernels/python3; let's have a look at it, and in particular the kernel.json file:

{
 "argv": [
  "$HOME/anaconda/bin/python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
}

Now you just need to duplicate all of that, and add "--profile=my_profile_name" in the "argv" list. Don't forget to give a different name to the Folder and and change "display_name": "Python 3" to "display_name": "Python 3 (my_profile)"; once this is available. just launch a qtconsole, a notebook or anything else with this kernel, and you should get your new profile.

You can of course use utilities like a2km to do that programmatically from the command line.

Matt
  • 27,170
  • 6
  • 80
  • 74
  • Thanks! I then just needed to make a new folder under jupyter/kernels named appropriately, place the file you described in it, and launch with 'jupyter qtconsole --kernel myfoldername' – Turtles Are Cute Sep 23 '17 at 19:43
  • Another solution: Run qtconsole from a location that contains an ipython_config.py file; this will override other profiles. – Turtles Are Cute Sep 23 '17 at 22:07