Comments (51)
In case others get here and are a little confused:
At the beginning of your notebook, run %matplotlib ipympl
, not %matplotlib notebook/nbagg
.
For installation
You need to install node.js.
In the terminal, run
conda install notebook jupyterlab # for updating jupyter notebook and lab
pip install ipympl
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib
from ipympl.
This is now working (shown with pinned versions so this will always work):
pip install jupyterlab==0.28.11 ipympl==0.0.8
jupyter labextension install @jupyter-widgets/jupyterlab-manager@^0.28 jupyter-matplotlib@^0.1
jupyter lab
%matplotlib ipympl
import matplotlib.pyplot as plt
plt.plot([0,1,1,2])
from ipympl.
Hi, any news about this issue?
from ipympl.
ipympl
is also available via conda, using the conda-forge channel.
from ipympl.
All you need to enable this is to import ipympl.
from ipympl.
Confirmed that it is still broken in the latest release, 0.21.0. Will try to look at this with @tacaswell next week.
from ipympl.
Ok, apparently npm
must be installed too. I saw the statement that nodejs
is required, but on Ubuntu installing nodejs
does not automatically install npm
.
from ipympl.
You'll need to use the current prerelease of jupyterlab pip install jupyterlab --pre
, or you'll need to install the previous release of the widget manager: jupyter labextension install @jupyter-widgets/[email protected]
.
from ipympl.
still not working (ipywidgets 6.0.0, matplotlib 2.0.2, jupyter lab: 0.25.2, Python 3.5.3). It would be appreciated to use nbagg in jupyter lab.
from ipympl.
Try -c conda-forge
instead of -c conda forge
from ipympl.
@blink1073, thanks for the info! Knowing it works for you made me re-test with a clean, just-created conda env, and it's now fine.
I was testing in an env I'd made exclusively to track jlab, but where I've upgraded jlab multiple times along the way. There must have been stale JS somewhere...
This points out the fact that right now, the upgrade process is still a bit rough: even though I'm isolating jlab into its own env with basically everything from conda and only lab and its dependencies being pulled in manually (plus plugins like this one), every now and then something will break in somewhat hard-to-diagnose ways.
Not complaining at all, just noting that fact so we're aware of it (or at least I keep it more in mind :)
We may want to remind that anyone having weird errors along the way, just nuke even their whole env and make it fresh. It's a bit brutal as a solution, but honestly it's a lot easier than tracking down where the problem may be coming from (and with good reproducibility habits, it's actually pretty painless to nuke/recreate a known env).
Thanks again much!! When the install/upgrade path for this gets smoother, it's going to be awesome for end users, in lab included.
from ipympl.
Great! Closing again, then.
from ipympl.
Looking again at the above - I realised I might not have the latest version of Jupyter Lab.
So I ran
conda install -c conda-forge jupyterlab
which upgraded Jupyter Lab to 0.31.0
Starting Jupyter Lab then asked for a rebuild - which I did. During the rebuild the following appeared in the bash script:
[3/4] 🔗 Linking dependencies...
warning "@jupyterlab/json-extension > [email protected]" has unmet peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0".
warning "@jupyterlab/json-extension > [email protected]" has unmet peer dependency "react@^15.0.0".
warning "@jupyterlab/json-extension > [email protected]" has unmet peer dependency "react-dom@^15.0.0".
warning "@jupyterlab/vdom-extension > @nteract/[email protected]" has unmet peer dependency "react@^15.6.1".
[4/4] 📃 Building fresh packages...
[-/4] ⢀ waiting...
[2/4] ⢀ canvas: gyp
[3/4] ⢀ jupyter-matplotlib: > webpack
[-/4] ⢀ waiting...
warning Error running install script for optional dependency: "/Users/Chris/anaconda3/share/jupyter/lab/staging/node_modules/canvas: Command failed.\nExit code: 1\nCommand: node-gyp rebuild\nArguments: \nDirectory: /Users/Chris/anaconda3/share/jupyter/lab/staging/node_modules/canvas\nOutput:\ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | darwin | x64\ngyp info spawn /usr/local/bin/python2\ngyp info spawn args [ '/Users/Chris/anaconda3/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',\ngyp info spawn args 'binding.gyp',\ngyp info spawn args '-f',\ngyp info spawn args 'make',\ngyp info spawn args '-I',\ngyp info spawn args '/Users/Chris/anaconda3/share/jupyter/lab/staging/node_modules/canvas/build/config.gypi',\ngyp info spawn args '-I',\ngyp info spawn args '/Users/Chris/anaconda3/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',\ngyp info spawn args '-I',\ngyp info spawn args '/Users/Chris/.node-gyp/8.9.3/include/node/common.gypi',\ngyp info spawn args '-Dlibrary=shared_library',\ngyp info spawn args '-Dvisibility=default',\ngyp info spawn args '-Dnode_root_dir=/Users/Chris/.node-gyp/8.9.3',\ngyp info spawn args '-Dnode_gyp_dir=/Users/Chris/anaconda3/lib/node_modules/npm/node_modules/node-gyp',\ngyp info spawn args '-Dnode_lib_file=/Users/Chris/.node-gyp/8.9.3/<(target_arch)/node.lib',\ngyp info spawn args '-Dmodule_root_dir=/Users/Chris/anaconda3/share/jupyter/lab/staging/node_modules/canvas',\ngyp info spawn args '-Dnode_engine=v8',\ngyp info spawn args '--depth=.',\ngyp info spawn args '--no-parallel',\ngyp info spawn args '--generator-output',\ngyp info spawn args 'build',\ngyp info spawn args '-Goutput_dir=.' ]\nPackage cairo was not found in the pkg-config search path.\nPerhaps you should add the directory containing `cairo.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'cairo' found\ngyp: Call to './util/has_lib.sh freetype' returned exit status 0 while in binding.gyp. while trying to load binding.gyp\ngyp ERR! configure error \ngyp ERR! stack Error: `gyp` failed with exit code: 1\ngyp ERR! stack at ChildProcess.onCpExit (/Users/Chris/anaconda3/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)\ngyp ERR! stack at emitTwo (events.js:126:13)\ngyp ERR! stack at ChildProcess.emit (events.js:214:7)\ngyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)\ngyp ERR! System Darwin 16.7.0\ngyp ERR! command \"/Users/Chrisuccess Saved lockfile.
✨ Done in 30.58s.
[I 13:09:02.896 LabApp] > node /Users/Chris/anaconda3/lib/python3.6/site-packages/jupyterlab/staging/yarn.js run build:prod
yarn run v1.3.2
After reloading the Jupyter Lab page, the %matplotlib ipympl
instruction triggered the same error traceback as in my original post above.
from ipympl.
Use the current prerelease of jupyterlab worked for me! Thanks @jasongrout.
from ipympl.
@johnmarktaylor91 You need to update ipykernel
/ ipython
to a version that is aware of ipympl.
You can also monkey patch in the right information.
from ipympl.
Worked for me:
conda install jupyterlab jupyterlab_server tk nodejs
pip install ipympl
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib
Then use %matplotlib widget
in notebook.
PS : or maybe it was conda install -c defaults -c conda-forge ...
from ipympl.
Oh, good catch!
from ipympl.
Apparently, it must be done at the right time?
/Users/klay6683/miniconda3/envs/stable/lib/python3.5/site-packages/matplotlib/__init__.py:1401: UserWarning: This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
warnings.warn(_use_error_msg)
from ipympl.
Still doesn't work. I put import ipympl
now as the first line of import in my .ipython profile startup, but still no plot is popping up in jupyterlab v0.16.
from ipympl.
@michaelaye I am sorry I replied from a mobile device earlier and missed that you were using jupyterlab.
We will add support for jupyterlab after we release ipywidgets 6.0.
from ipympl.
Could someone edit the title to "Notebook backend not working"?
It would be nice to get the notebook/nbagg backend working in jupyter lab. I know many users enjoy having an inline interactive backend.
from ipympl.
Hopefully this will get worked on at the jupytcon sprints next month.
from ipympl.
Thanks!
from ipympl.
Are the interactivity features not yet ported? I don't see any zoom/pan etc icons?
from ipympl.
I tried this out the other day and was able to get mouse clicks to trigger python callbacks.
from ipympl.
Should this be reopened for current versions of JLab? I followed @blink1073's instructions above to the letter, with jlab 0.28.11 and ipympl 0.0.8, and it works perfectly.
However, with the current version of JLab (0.30.5) and ipympl 0.1.0, I'm getting with either import ipympl
or %matplotlib ipympl
the same "Error displaying widget" message.
from ipympl.
Hi @fperez! I just tried with Jlab (0.30.5) and ipympl 0.1.0 and it "Works on My Machine".
from ipympl.
@jasongrout, any debug tips?
from ipympl.
On my machine the setup is failing at
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib
> '' pack @jupyter-widgets/jupyterlab-manager
expected str, bytes or os.PathLike object, not NoneType
Already tried deleting and reinstalling the python user env, which worked for @fperez. The packages installed from pip are ipympl-0.1.0
, jupyterlab-0.30.6
. Any idea how to debug this?
from ipympl.
Thanks @pwuertz, looks like we need a better check for whether npm is available.
from ipympl.
I'm getting the following error:
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib
> /home/carstena/anaconda3/bin/npm pack @jupyter-widgets/jupyterlab-manager
jupyter-widgets-jupyterlab-manager-0.32.3.tgz
"@jupyter-widgets/[email protected]" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab Extension Package
>=0.13.1-0 <0.14.0-0 >=0.14.1-0 <0.15.0-0 @jupyterlab/application
>=0.13.0-0 <0.14.0-0 >=1.0.1-0 <2.0.0-0 @jupyterlab/coreutils
>=0.13.0-0 <0.14.0-0 >=0.14.1-0 <0.15.0-0 @jupyterlab/notebook
>=0.13.0-0 <0.14.0-0 >=0.14.1-0 <0.15.0-0 @jupyterlab/rendermime
>=0.4.3-0 <0.5.0-0 >=1.0.1-0 <2.0.0-0 @jupyterlab/rendermime-interfaces
>=0.52.0-0 <0.53.0-0 >=1.0.1-0 <2.0.0-0 @jupyterlab/services
Anaconda 3; jupyter lab & nodejs installed via conda; npm & ipympl via pip.
from ipympl.
I'm also having this problem - and having followed advice above can't seem to resolve it.
I checked the following versions:
jupyterlab - 0.30.6 (conda installed) (NOTE - see update post below)
node.js - 6.11.2 (conda installed)
ipympl - 0.1.0 (conda installed)
npm - 5.5.1 (not installed directly - perhaps already present, perhaps installed when node.js installed)
MacOS 10.12.6
Trying to run jupyter lab triggered an instruction to rebuild jupyter lab - which I did.
Running the %matplotlib ipympl
in a notebook triggered the error pasted below.
Any suggestions how to get the interactive charting in matplotlib working in JupyterLab?
%matplotlib ipympl
error:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-1-e929c3fad522> in <module>()
2 #%matplotlib notebook
3
----> 4 get_ipython().magic('matplotlib ipympl')
5
6 # %matplotlib inline
/Users/Chris/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
2156 magic_name, _, magic_arg_s = arg_s.partition(' ')
2157 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2158 return self.run_line_magic(magic_name, magic_arg_s)
2159
2160 #-------------------------------------------------------------------------
/Users/Chris/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
2077 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2078 with self.builtin_trap:
-> 2079 result = fn(*args,**kwargs)
2080 return result
2081
<decorator-gen-104> in matplotlib(self, line)
/Users/Chris/anaconda3/lib/python3.6/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
186 # but it's overkill for just that one bit of state.
187 def magic_deco(arg):
--> 188 call = lambda f, *a, **k: f(*a, **k)
189
190 if callable(arg):
/Users/Chris/anaconda3/lib/python3.6/site-packages/IPython/core/magics/pylab.py in matplotlib(self, line)
98 print("Available matplotlib backends: %s" % backends_list)
99 else:
--> 100 gui, backend = self.shell.enable_matplotlib(args.gui)
101 self._show_matplotlib_backend(args.gui, backend)
102
/Users/Chris/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py in enable_matplotlib(self, gui)
2933 """
2934 from IPython.core import pylabtools as pt
-> 2935 gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)
2936
2937 if gui != 'inline':
/Users/Chris/anaconda3/lib/python3.6/site-packages/IPython/core/pylabtools.py in find_gui_and_backend(gui, gui_select)
261 if gui and gui != 'auto':
262 # select backend based on requested gui
--> 263 backend = backends[gui]
264 else:
265 # We need to read the backend from the original data structure, *not*
KeyError: 'ipympl'
from ipympl.
@chrisrb10 I'd try uninstalling jupyterlab with conda and installing with pip install jupyterlab --pre
per @jasongrout's instructions above.
from ipympl.
@thomasaarholt thanks - I tried that.
Got the same rebuild error code as above, and then the same error when I tried to run
%matplotlib ipympl
in jupyter lab
If it is relevant - my Jupyter notebook is v.5.0.0. I have upgraded to more recent versions (5.2, 5.3) but each time I do I lose the ability to download as html (this issue) - so downgraded back to 5.0.0.
from ipympl.
To all wanderers, make sure to conda install --channel conda-forge nodejs
, not node
.
from ipympl.
I have the same problem as chrisrb10 ("KeyError")... any luck on that front?
from ipympl.
With the latest version of jupyter-matplotlib
(0.2.1), the way to enable the interactive back-end is with
%matplotlib widget
from ipympl.
This gives me the same problem with the KeyError.
from ipympl.
Is ipympl installed?
from ipympl.
Yup. "Import ipympl" works with no hitches.
from ipympl.
What is the version of matplotlib?
from ipympl.
2.0.0
from ipympl.
I updated ipykernel to the most recent version and still the same error.
from ipympl.
I had to install yarn to be able to run jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib
before I got:
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@jupyterlab%2fapplication: self signed certificate in certificate chain".
After installing yarn I ran:
yarn config set "strict-ssl" false
When reopening the terminal it ran successfully!
from ipympl.
Just go through this PATH definitely it will fix your problem
start -> anaconda or jupyter notebook prompt
step fist-> pip install nbconvert==5.4.1
step second -> python -m pip install --upgrade pip
please let me know once you fix it
from ipympl.
when i try to install jupyter matplotlib using the command "conda install -c conda forge ipympl" on anaconda prompt here's the error that prompt
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- forge
Current channels:
- https://conda.anaconda.org/conda/win-64
- https://conda.anaconda.org/conda/noarch
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
solution please!!
from ipympl.
I fear you are mixing the conda-forge
with other channels. I would suggest sticking with the conda-forge channel and not use other channels in the same environment, because that can bring issues. conda-forge should already contain everything you need.
from ipympl.
Ok let me try
from ipympl.
Thanks really helped
from ipympl.
In case others get here and are a little confused: At the beginning of your notebook, run
%matplotlib ipympl
, not%matplotlib notebook/nbagg
.For installation You need to install node.js. In the terminal, run
conda install notebook jupyterlab # for updating jupyter notebook and lab pip install ipympl jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib
thank you, for Arch it helped to install jupyterlab-widgets from the repository.
from ipympl.
Just a note that starting with jupyterlab v4, you should NEVER run jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib
or any other jupyter labextension install
commands.
from ipympl.
Related Issues (20)
- Unable to access ipympl from JupyterLab due to Error displaying widget: model not found
- Question: should I use `%matplotlib widget` or `%matplotlib ipympl` HOT 4
- DepreciationWarning in toolbar causes AttributeError
- ipympl crashes when panning/zooming
- JupyterLab 4.x support HOT 4
- [FR] Cursor Control HOT 1
- Latest version of everything still causes the dreaded Error displaying widget: model not found HOT 11
- An error in use of inset_axes of mpl_toolkits in Jupyter Notebook HOT 2
- [email protected]
- Comptability with mpl cursors
- Failed to load model class 'MPLCanvasModel' from module 'jupyter-matplotlib' Error: No version of module jupyter-matplotlib is registered. HOT 6
- Please remove jupyterlab==3.* requirement so as to allow 4.x to work. HOT 3
- Ability to configure defaults for `Canvas`
- Interactive graph - Saving
- Error: No version of module jupyter-matplotlib is registered HOT 5
- [test-bot] Scheduled Tests are failing
- Matplotlib Fails to Update Axis Limits with ipywidgets in Jupyter Lab HOT 1
- Question: how to use ipympl to simply include axes in ipywidets layout? HOT 1
- Large top/bottom padding for imshow images HOT 5
- Blank figures in Jupyter notebook HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipympl.