Closed poke1024 closed 8 years ago
I got an error when trying to use Manipulate
:
(using this branch of imathics and mathics/Mathics/pull/362)
(<class 'RuntimeError'>, RuntimeError('Comms cannot be opened without a kernel and a comm_manager attached to that kernel.',), <traceback object at 0x7ff12ed08308>)
.
Edit: Just noticed this warning message (could be related):
(venv) angus@varch> jupyter notebook
/home/angus/venv/lib/python3.5/site-packages/widgetsnbextension/__init__.py:30: UserWarning: To use the jupyter-js-widgets nbextension, you'll need to update
the Jupyter notebook to version 4.2 or later.
the Jupyter notebook to version 4.2 or later.""")
It's a bit strange since I am running 4.2:
(venv) angus@varch> jupyter notebook --version
4.2.0
I'm using jupyter notebook version 4.1.0. I'll investigate...
I'm wondering if we should add ipywidgets
to the setup.py install_requires
.
I just removed ipywidgets from my installation and it basically still starts up without errors; but I'm guessing it's some kind of configuration thing (module versions, ...).
I didn't manage to install Jupyter 4.2, I probably have to wait for the pip package which will be a few days I guess.
I looked at it, but I don't get it. The exception seems to be thrown from ipykernel/comm/comm.py:
comm_manager = getattr(self.kernel, 'comm_manager', None)
if comm_manager is None:
raise RuntimeError("Comms cannot be opened without a kernel "
"and a comm_manager attached to that kernel.")
self.kernel
of course is a MathicsKernel
in our case. Since one of the things in the changed MathicsKernel
constructor is to call self.establish_comm_manager()
which which will do a self.comm_manager = CommManager()
. So how can kernel.comm_manager
end up None
?
In ipykernel/ipykernel.py
the ipython guys install their CommManager, and they do it in the same way (i.e. there really shouldn't be any ipykernel open calls before the Kernel constructor has finished) :
https://github.com/ipython/ipykernel/blob/4.x/ipykernel/ipkernel.py
I have Jupyter 4.2 now, turns out conda has the latest package. I cannot reproduce it though.
I tried debugging this and quickly realised I was on the wrong Imathics branch. Sorry about that. I'm not sure what that warning is, it seems unrelated.
I'm quite glad to hear that actually. :-)
Got it working, It looks great!
Had some issues with virtualenv/jupter-nbextension. In addition to installing ipywidgets you have to run:
jupyter nbextension enable --py widgetsnbextension --sys-prefix
This is similar to how you have to install the imathics kernels manually (although there are some hacks to workaround this). I wonder if it makes sense to collect this initialisation stuff up somewhere.
Are you on a developer install of ipywidgets
? Then it seems to be the expected behaviour to have to manually enable the widgetsextenstion
:
https://github.com/ipython/ipywidgets/blob/master/docs/source/dev_install.md
Using a vanilla pip install of ipywidgets on the other hand seems to enable it automatically. So, it's probably a thing only on development builds.
Still, there must be a way to check for the existence of widgetsnbextension
, but I didn't yet find a way to do that.
I installed ipywidgets with pip, maybe it was because of the virtualenv.
I'm happy to to merge this after mathics/Mathics#366.
resubmitted, though Travis still fails because these changes depend on the corresponding changes in Mathics