These are chat archives for ipython/ipython

17th
Nov 2014
Stuart Mumford
@Cadair
Nov 17 2014 16:30
Hello, I have a question regarding the notebook kernel switcher
It would be awesome if it could be made to read virtualenvs / conda environments on a systemwide level
hang on, I am not explaining myself well here.
I have ipython installed under conda
in a system wide directory
I would like to be able to create a kernel for a python 2 conda env that evey user of the system conda install inherits
from looking through the code, I think I could do this by putting a kernelspec directory in one of these folders: https://github.com/ipython/ipython/blob/master/IPython/kernel/kernelspec.py#L21
?
Doug Blank
@dsblank
Nov 17 2014 16:34
You using IPython 2 or master, IPython 3?
Scott Sanderson
@ssanderson
Nov 17 2014 16:34
@Cadair do you want to be able to switch between multiple such virtualenvs? If I recall correctly, running ipython notebook from inside a virtualenv will inherit from the virtualenv
Stuart Mumford
@Cadair
Nov 17 2014 16:34
master
@ssanderson yes I want to be able to switch between virtualenvs
Doug Blank
@dsblank
Nov 17 2014 16:34
You can install kernelspecs into a system wide directory.
Stuart Mumford
@Cadair
Nov 17 2014 16:35
@dsblank yes, I think I see that, but they seem hard coded to SYSTEM_KERNEL_DIRS = ["/usr/share/ipython/kernels", "/usr/local/share/ipython/kernels", ]
which is not where my conda install is
:)
Doug Blank
@dsblank
Nov 17 2014 16:35
I see. Yes, that sounds like it needs to be a configurable.
Stuart Mumford
@Cadair
Nov 17 2014 16:36
@dsblank of course it would be even cooler if it were possible to write a plugin or something which would automatically find all the conda envs or virtualenvs and list them all
Scott Sanderson
@ssanderson
Nov 17 2014 16:36
I think KernelSpecManager.kernel_dirs is what you want
Stuart Mumford
@Cadair
Nov 17 2014 16:37
ahhh nice
Scott Sanderson
@ssanderson
Nov 17 2014 16:37
that uses the global constant by default, but looks like it's overridable
Stuart Mumford
@Cadair
Nov 17 2014 16:39
I could override that in a config file?
Stuart Mumford
@Cadair
Nov 17 2014 16:46
Can I do that config on a global level?
Stuart Mumford
@Cadair
Nov 17 2014 16:59
also would it not be better to use sys.prefix for the SYSTEM_KERNEL_DIRS?
Matthias Bussonnier
@Carreau
Nov 17 2014 17:56
@Cadair just create a kernelspec that run a bashcript activate the venv and start the IPython kernel. it shoudl be enough
Anything that start a kernel and bind to port will work. So you can even start kernels with differents versions of IPython. No need to modify IPython for that.
Sylvain Corlay
@SylvainCorlay
Nov 17 2014 19:40
Hello
Matthias Bussonnier
@Carreau
Nov 17 2014 20:05
Hi.
Jonathan Frederic
@jdfreder
Nov 17 2014 20:11
@/all the widget promise PR is passing and comments are addressed. Anyone want to review it some more? I'd like to get the persistence API stuff worked out, but it's blocked by the promise PR.
Thomas Kluyver
@takluyver
Nov 17 2014 20:12
I'll try to have a look, but I don't know how far I'll get before lunch
Jonathan Frederic
@jdfreder
Nov 17 2014 20:13
Thanks @takluyver :horse:
Brian E. Granger
@ellisonbg
Nov 17 2014 23:01
@takluyver I just updated to master and tried using the "New Terminal" button in the dashboard. That worked fine, but then when I clicked on "Shutdown" I got an infinite loop of tracebacks in the console that launched the notebook.
raise RuntimeError("Method not supported for Web Sockets")
Sylvain Corlay
@SylvainCorlay
Nov 17 2014 23:02
catch RuntimeError:
pass
Jason Grout
@jasongrout
Nov 17 2014 23:39
@jdfreder-I'll try to look at it a bit tomorrow to