Skip to content
This repository has been archived by the owner on Feb 4, 2018. It is now read-only.

Python 3, ipywidgets 5.x and kernel names #73

Open
benureau opened this issue Aug 11, 2016 · 6 comments
Open

Python 3, ipywidgets 5.x and kernel names #73

benureau opened this issue Aug 11, 2016 · 6 comments

Comments

@benureau
Copy link

benureau commented Aug 11, 2016

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:
screen shot 2016-08-11 at 11 40 59 am

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?

@mbakker7
Copy link

mbakker7 commented Sep 8, 2016

Did you come around any fix? I have the exact same problem. Odd.

@benureau
Copy link
Author

benureau commented Sep 9, 2016

No, I did not got deeper into the issue. I think this has something to do with different jupyter maintaining different list of kernels, but I did not manage to find clear information about that so far.

@minrk
Copy link

minrk commented Sep 9, 2016

This is a bug in the nb_conda_kernels package that is part of Anaconda, and fixed in more recent versions. Updating nb_conda_kernels should fix it.

@mbakker7
Copy link

mbakker7 commented Sep 9, 2016

Great! Any idea on how to update? Lots of website on how to install, but
not on how to update.

Thanks, Mark

On Fri, Sep 9, 2016 at 1:40 PM, Min RK notifications@github.com wrote:

This is a bug in the nb_conda_kernels package that is part of Anaconda,
and fixed in more recent versions. Updating nb_conda_kernels should fix it.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#73 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABTNyDDTFurQ7ylLFNh_P_b6pQzpswPFks5qoUXLgaJpZM4Jh-I8
.

@benureau
Copy link
Author

benureau commented Sep 9, 2016

I don't have time to test it right now, but what about:

conda update nb_conda nb_conda_kernels nb_anacondacloud

(from https://groups.google.com/forum/#!topic/jupyter/qE6fCyXe6fs)

@nthiery
Copy link

nthiery commented Dec 4, 2016

Dear binder / jupyter devs,

I just got what seems to be the same issue. To reproduce, execute the three first cells of:

http://mybinder.org/repo/nthiery/test-binder/

It briefly displays:

Widget Javascript not detected.  It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"

and the widgets are not displayed.

This was working last week; I noticed the notebook on mybinder was using ipywidgets 4 back then, and now ipywidgets 5. This could be the result result from a change in my setup in the mean time (the repo is now a pip installable package).

Any suggestion on how to fix this? I am happy adjusting my setup.py / requirements.txt. however, since using interacts is a common use case -- and assuming I have not done something stupid -- it would be nice to have them work out of the box.

Thanks in advance!
Nicolas

PS: the above repo is an experiment I did with a friend from earth-sciences; he was amazed by the jupyter+interact+mybinder technology for making his code accessible through interactive web-based forms.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants