Closed rafaelobraun closed 8 years ago
Did you enable the widgetsnbextension? You need to do
jupyter nbextension enable --py --sys-prefix widgetsnbextension
It mentions this in the readme to ipywidgets, but it doesn't say anything on the pypi page, and maybe it doesn't say it when you install? We're working on making this part automatic, but it's not automatic yet.
@SylvainCorlay, can we update the pypi long description to mention this, and also make the setup.py explicitly print this step when installing, if it doesn't do that now? At least until we get this step to be automatic?
It works with Jupyter Notebooks, but now it don't works with Jupyterhub. Is the configuration different?
Thanks.
@jasongrout can you point me to the doc to say why users need to
jupyter nbextension enable --py --sys-prefix widgetsnbextension
. thanks.
(What's benefit of asking users to do that). We are working on a protein viewer in notebook and this new behavior caused me much trouble (I don't know why until reading this issue).
updated
I've just read your comment above. Sorry for not reading thoroughly.
We're working on making this part automatic, but it's not automatic yet
Now it works with the new version on Jupyterhub too. Thanks. Rafael ipywidgets 5.1.3 widgetsnbextension 1.2.2
@hainm: https://github.com/ipython/ipywidgets/blob/master/README.md#install is where it says you have to enable the wigetsnbextension (currently).
The actual documentation helped me. This should fix the problem:
jupyter nbextension enable --py widgetsnbextension
However since I use macports, I have to fix it slightly different:
jupyter-nbextension-2.7 enable --py widgetsnbextension
I have this same issue but also enabling the extension
jupyter nbextension enable --py --sys-prefix widgetsnbextension
nothing and the dependencies seems to be meet.
` $ conda list
backports 1.0 py35_0 defaults
backports.shutil-get-terminal-size 1.0.0
@cardosan - can you open a new issue and post the results of jupyter nbextension list
there?
HI Jason, while writing the issue I realized that now (very strange) without changing anything is working...maybe needed simply to reboot. Thanks G
Great!
For some reason, on Anaconda Python 3.6, running:
jupyter nbextension enable --py --sys-prefix widgetsnbextension
did not work for me, but:
jupyter nbextension enable --py
did!
Maybe it's worth elaborating on this in the documentation?
You meant jupyter nbextension enable --py widgetsnbextension
Maybe it's worth elaborating on this in the documentation?
I highly recommend that people use --sys-prefix
(and figure out why that didn't work), rather than using the personal location without --sys-prefix
. It sounds like @ostrokach had widgets installed in the personal location rather than the sys-prefix location. I think it would be better to delete widgets out of the personal location
But I always see the sys-prefix option recommended to be removed for conda users? Are you saying that's all wrong?
I recommend the --sys-prefix
option especially for conda users. I think it's the only way to easily keep things consistent and sane. That keeps the installed software consistent with the environment you are in. Otherwise, it's easy to get into the situation where you have one version of a package javascript installed in your personal directory used with an environment with a totally different version of the python package.
To be clear, this illustrates the huge problem with not using --sys-prefix with conda:
jupyter nbextension install --py widgetsnbextension
. This installs the javascript into their home directory, not tied to any environment. They also enable the extension in their home directory.--overwrite
), and sets up the same problem for a different environment.I think it's much better to install to --sys-prefix
, so the extension and the enabling is constrained to the environment you have activated. You switch to a new environment, and you have a fresh clean slate.
Thanks so much. I think I got that completely inverse before you explained it. Just one more thing, I saw one of these writing into my user Library on the Mac, is that what you mean with user's home? For example, right now I have the Jupyter extensions complaining at start up that they have definition files twice, I guess because I switched between different options s at some stage.
You can do jupyter --paths
to see where the various files would go. The first lines are the personal locations, followed by the sys-prefix locations, followed by system locations. For me, the personal files do go into my Library directory on OS X.
Personally I regularly completely delete my user-level config, and rely solely on sys-prefix.
Hello. I just installed Anaconda Python 3.6 version on Windows 7, and I got the same error. I implemented this command (jupyter nbextension enable --py --sys-prefix widgetsnbextension) on the Anaconda Prompt, but the problem is still there. I also tried running jupyter nbextension enable --py widgetsnbextension, but no success. I tried several times installing, uninstalling, rebooting etc. Could someone help me on this please?
Note: When I run Jupyter Notebook, I get this:
@jasongrout Could you please help?
@rafaelobraun Can you please edit your comment and write how does it work in jupyterhub? I can't find any way to make it work, so much so that I opened a issue with jupyterhub itself https://github.com/jupyterhub/jupyterhub/issues/1113
I'm struggling to get this to work for the jupyter nbconvert command on a remote machine. Locally it works tough. I have a separate conda env running, so I used --sys-prefix for the command. The extension is being listed as enabled, however I still get those error messages.
Any help would be really appreciated.
When you run that jupyter nbextension enable --py --sys-prefix widgetsnbextension, do you do that within or outside of some conda environment (that is, have you "activated" the environment or not)? Nobody seems to mention this, does it even matter? I've install that "nb_conda" thing to get virtual environments inside jupyter notebook - and I always start jupyter notebook in "root" (i.e. not having activated any virtual environment), instead specifying environment within jupyter notebook. Which is great.
If it isn't obvious, I have no clue of what I am talking about - but after getting this to work after 45 minutes of banging my head on the keyboard, I still don't know where and how I installed or enabled that freakin' widgetsnbextension. Which isn't very satisfying.
One more thing: Does "enable" imply "install", or should you do install, then enable? For me, this might have made a difference..
The enable command needs to be run in the same environment as the notebook is running. If you start the notebook from the root environment, then that's where you need to do the enable command.
Enable doesn't imply install. However, installing the widgetsnbextension python package automatically installs the notebook extension in the same environment.
On Fri, Jun 30, 2017, 16:26 stolsvik notifications@github.com wrote:
One more thing: Does "enable" imply "install", or should you do install, then enable? For me, this might have made a difference..
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jupyter-widgets/ipywidgets/issues/541#issuecomment-312365262, or mute the thread https://github.com/notifications/unsubscribe-auth/AALwZg4-0rPr0lZaR17zKZTJHyc5xgpKks5sJVnhgaJpZM4IRwca .
I had this problem on mac so I solved it by:
jupyter nbextension enable --py --sys-prefix widgetsnbextension
The error went away after that.
This is a recurring issue for me, probably because I have some user config files, and do switch between a few virtual environments (not conda environments). The command with --sys-prefix
doesn't get rid of the "widget javascript not detected" warning, but the command without does -- at least temporarily. At the moment, I'm not able to reproduce the warning by switching between virtual environments and running jupyter notebook
on each (with a small test notebook that uses tqdm.tqdm_notebook
), but I am able to reproduce it with a more complicated real notebook. (Additionally using a %matplotlib inline
magic to the test notebook doesn't trigger it there either, though it does appear to happen in that notebook after I've run the more complicated one to the point where it uses tqdm
and triggers the warning.)
As @jasongrout mentioned, I might want to delete some user config files, after which the command with --sys-prefix
might work. However, I'm not sure what to delete. I have a ~/.jupyter/jupyter_notebook_config.py
file that contains, most importantly, a hashed password that I want to keep using. Running jupyter --paths
with the environment venv3
activated gives this output:
config:
/home/tsbertalan/.jupyter
/home/tsbertalan/venv3/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter
data:
/home/tsbertalan/.local/share/jupyter
/home/tsbertalan/venv3/share/jupyter
/usr/local/share/jupyter
/usr/share/jupyter
runtime:
/run/user/1000/jupyter
However, /home/tsbertalan/venv3/share/jupyter
does not contain a jupyter_notebook_config.py
file.
Is it only ~/.jupyter/nbconfig/notebook.json
that I would delete (which has no important differences from ~/venv3/etc/jupyter/nbconfig/notebook.json
)? Are there perhaps packages that I'd need to reinstall with pip in the environment(s)? Are the extensions being "activated" something separate from simple python packages, which I perhaps also would want to delete from somewhere in ~/.jupyter? Deleting ~/.jupyter/nbconfig/notebook.json
before running the --sys-prefix
command doesn't seem to kill the warning. Only running the command without the extra flag does, and even then not always--I'm not sure when.
@tsbertalan, have you checked /home/tsbertalan/.local/share/jupyter
? I had overlooked that folder myself previously and removing it cleared this problem.
Thanks, @blink1073 . If I rename that folder and then run jupyter nbextension enable --py --sys-prefix widgetsnbextension
in the virtualenv, I still get the warning. If I deactivate the environment and run the command again, I get
IOError: [Errno 13] Permission denied: u'/usr/etc/jupyter/nbconfig/notebook.json'
Do any of you know whether I should I be running it out of virtualenv as root? I expect the answer is no.
Huh. Maybe I spoke too soon. I ran the command one more time in the virtualenv, deactivated and reactivated it, and started my notebook, and now the warning seems to be gone. I guess if it comes back, I'll complain here.
FYI -- I struggled for a while with this, and then ran the install steps outside of my conda virtual environment and it finally worked.
I have the same issue (widgets not detected) with jupyter notebooks in binder.
See https://github.com/boisgera/tmp-notebook for the setup (Python 2.7; AFAICT Python 3.x works fine).
Configuration:
$ conda list
# packages in environment at /srv/conda:
#
asn1crypto 0.22.0 py36h265ca7c_1 defaults
bleach 2.0.0 py36_0 conda-forge
ca-certificates 2017.11.5 0 conda-forge
certifi 2017.11.5 py36_0 conda-forge
cffi 1.10.0 py36had8d393_1 defaults
chardet 3.0.4 py36h0f667ec_1 defaults
conda 4.3.30 py36h5d9f9f4_0 defaults
conda-env 2.6.0 h36134e3_1 defaults
cryptography 2.0.3 py36ha225213_1 defaults
decorator 4.1.2 py36_0 conda-forge
entrypoints 0.2.3 py36_1 conda-forge
gmp 6.1.2 0 conda-forge
html5lib 1.0.1 py_0 conda-forge
idna 2.6 py36h82fb2a8_1 defaults
ipykernel 4.7.0 py36_0 conda-forge
ipython 6.2.1 py36_1 conda-forge
ipython_genutils 0.2.0 py36_0 conda-forge
ipywidgets 6.0.1 py36_0 conda-forge
jedi 0.10.2 py36_0 conda-forge
jinja2 2.10 py36_0 conda-forge
jsonschema 2.6.0 py36_0 conda-forge
jupyter_client 5.2.1 py36_0 conda-forge
jupyter_core 4.4.0 py_0 conda-forge
jupyterlab 0.30.6 py36_0 conda-forge
jupyterlab_launcher 0.6.0 py36_0 conda-forge
libedit 3.1.20170329 0 conda-forge
libffi 3.2.1 h4deb6c0_3 defaults
libgcc-ng 7.2.0 h7cc24e2_2 defaults
libsodium 1.0.15 1 conda-forge
libstdcxx-ng 7.2.0 h7a57d05_2 defaults
markupsafe 1.0 py36_0 conda-forge
mistune 0.8.3 py_0 conda-forge
nbconvert 5.3.1 py_1 conda-forge
nbformat 4.4.0 py36_0 conda-forge
ncurses 5.9 10 conda-forge
notebook 5.2.2 py36_1 conda-forge
openssl 1.0.2n 0 conda-forge
pandoc 2.1 0 conda-forge
pandocfilters 1.4.1 py36_0 conda-forge
pexpect 4.3.1 py36_0 conda-forge
pickleshare 0.7.4 py36_0 conda-forge
pip 9.0.1 py36_1 conda-forge
prompt_toolkit 1.0.15 py36_0 conda-forge
ptyprocess 0.5.2 py36_0 conda-forge
pycosat 0.6.2 py36h1a0ea17_1 defaults
pycparser 2.18 py36hf9f622e_1 defaults
pygments 2.2.0 py36_0 conda-forge
pyopenssl 17.2.0 py36h5cc804b_0 defaults
pysocks 1.6.7 py36hd97a5b1_1 defaults
python 3.6.4 0 conda-forge
python-dateutil 2.6.1 py36_0 conda-forge
pyzmq 16.0.2 py36_3 conda-forge
readline 7.0 0 conda-forge
requests 2.18.4 py36he2e5f8d_1 defaults
ruamel_yaml 0.11.14 py36ha2fb22d_2 defaults
setuptools 38.4.0 py36_0 conda-forge
simplegeneric 0.8.1 py36_0 conda-forge
six 1.11.0 py36_1 conda-forge
sqlite 3.20.1 2 conda-forge
terminado 0.8.1 py36_0 conda-forge
testpath 0.3.1 py36_0 conda-forge
tk 8.6.7 0 conda-forge
tornado 4.5.3 py36_0 conda-forge
traitlets 4.3.2 py36_0 conda-forge
urllib3 1.22 py36hbe7ace6_0 defaults
wcwidth 0.1.7 py36_0 conda-forge
webencodings 0.5 py36_0 conda-forge
wheel 0.30.0 py36_2 conda-forge
widgetsnbextension 2.0.1 py36_0 conda-forge
xz 5.2.3 0 conda-forge
yaml 0.1.7 h96e3832_1 defaults
zeromq 4.2.1 1 conda-forge
zlib 1.2.11 0 conda-forge
Running
jupyter nbextension enable --py widgetsnbextension
again worked for me. But using
jupyter nbextension enable --py --sys-prefix widgetsnbextension
did not work.
I used jupyterLab, it cannot work too. but I un-install the jupyterlab, and use jupyter, it can work.
I tried all of these things and nothing worked until I switched into a Python 3 kernel (previously trying to use a Python 2 kernel). Not sure if that is explicitly instructed anywhere, but thought it might be helpful to someone.
I use jupyterlab and I have the same issue. Nothing of above mentioned solutions help...
` ~ $ jupyter nbextension list Known nbextensions: config dir: /home/natallia/.jupyter/nbconfig notebook section jupyter-js-widgets/extension enabled
` Any ideas how to make it work for jupyter lab ???
Maybe this helps someone to get active figures back in jupyterlab:
conda remove ipympl
b. pip uninstall ipympl
(in case I mixed GH/pip installs with conda)
c. repeat b. until no ipympl is found, there can be more than one!conda install ipympl
conda install nodejs
b. jupyter labextension install @jupyter-widgets/jupyterlab-manager
If you already have installed nodejs
you can of course skip 4a.
Also, there may be other steps you can skip, but this procedure helped me to get my matplotlib figures back, using %matplotlib ipympl
This worked for me on two different macOS 10.12.6 machines.
Fantastic, @michaelaye ! It was exactly, what was needed to make it work!!! Thank you a lot!
Thanks @michaelaye!
In my case, it appears ipywidgets
was an old version even though the environment was recently set up.
In case anyone else is in the same situation as me: To install ipympl
, I had to include -c conda-forge
and added -c defaults
before that for good measure:
conda install ipympl -c defaults -c conda-forge
This produced the following output:
The following NEW packages will be INSTALLED:
ipympl: 0.1.1-py36_0 conda-forge
The following packages will be UPDATED:
ipywidgets: 6.0.0-py36_0 --> 7.2.1-py36_0
So, apparently ipywidgets
was outdated, and a new version was found in the defaults
channel.
After running this, i removed both .config/jupyter
and .local/share/jupyter
to make sure no old config files were present. Finally, I ran the above-mentioned
jupyter nbextension enable --py --sys-prefix widgetsnbextension
and I now have interactive notebook widgets working in my new environment!
After the update from ipywidgets (5.1.0) and widgetsnbextension (1.1.0) an error occurr with my Jupyter notebooks: [IPKernelApp] WARNING | Widget Javascript not detected. It may not be installed properly.
Thanks
Rafael