Python 3, ipywidgets 5.x and kernel names #73
Description
My code/repo https://github.com/humm/pvlv is using Python 3 and ipywidgets 5.x. This now requires to run
jupyter nbextension enable --py --sys-prefix widgetsnbextension
. Failing that, the widgets don't show nor work.
When configuring with a simple requirements.txt file, jupyter 4.1.1 from python 2.7.11 is used, but it correctly launches a Python 3
kernel for the notebooks. However, the jupyter nbextension enable --py --sys-prefix widgetsnbextension
command does not work, and widgets throw an error message.
I tried to resolve this with a Dockerfile, but I could not figure out how to switch the entire image to Python 3 properly. I tried using RUN /bin/bash -c "source activate python3"
, but this is only valid for this line: the next RUN
command in the Dockerfile use the 2.7.11 python.
I finally decided to mess with the path: ENV PATH $HOME/anaconda2/envs/python3/bin/:$PATH
, which feels a bit icky, but it forces Python 3 on the entire image. And it works for pip
too. And... jupyter
. So the jupyter that runs the notebook is now the one of python 3.5. More precisely:
The version of the notebook server is 4.2.1 and is running on:
Python 3.5.2 |Anaconda 4.1.1 (64-bit)| (default, Jul 2 2016, 17:53:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
This jupyter has somewhat different kernel names (Python [Root]
and Python [python3]
), and seems unable to find a match for the notebook kernelspec, which leads to an annoying dialog:
For reference, the kernelspec my notebook is asking for is:
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
So the issue is not that problematic, and quite involved. But I feel like there is a quick fix for the kernel matching somewhere. Does anyone with more familiarity with the kernelspec/ipykernel install/jupyter has any idea?