Thanks to visit codestin.com
Credit goes to github.com

Skip to content

No plots shown with matplotlib widget #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fwsmit opened this issue Nov 22, 2021 · 9 comments
Closed

No plots shown with matplotlib widget #399

fwsmit opened this issue Nov 22, 2021 · 9 comments

Comments

@fwsmit
Copy link

fwsmit commented Nov 22, 2021

The widget backend doesn't seem to work for me. Even very simple plots don't show up. This issue looks like #171, but for me even simple matplotlib plots don't show up.

Behaviour with inline backend

%matplotlib inline
import matplotlib.pyplot as plt

plt.plot([[1, 2], [0, 0]])

20211122_16h35m50s_grim

Behaviour with widget backend

%matplotlib widget
import matplotlib.pyplot as plt

plt.plot([[1, 2], [0, 0]])

20211122_16h36m07s_grim

There isn't a new window with the plot either.

Versions

Distro: Arch Linux
Package versions:

ipython 7.29.0-1
python-ipympl 0.8.2-1
python-matplotlib 3.4.3-1
python-ipywidgets 7.6.5-1
python -c "import sys; print('\n',sys.version); import ipympl; print('ipympl version:', ipympl.__version__)" && jupyter --version && jupyter nbextension list && jupyter labextension list
 3.9.7 (default, Oct 10 2021, 15:13:22) 
[GCC 11.1.0]
ipympl version: 0.8.2
Selected Jupyter core packages...
IPython          : 7.29.0
ipykernel        : 6.4.1
ipywidgets       : 7.6.5
jupyter_client   : 6.1.12
jupyter_core     : 4.8.1
jupyter_server   : 1.11.2
jupyterlab       : 3.2.3
nbclient         : 0.5.4
nbconvert        : 6.1.0
nbformat         : 5.1.3
notebook         : 6.4.4
qtconsole        : not installed
traitlets        : 5.1.0
Known nbextensions:
  config dir: /usr/etc/jupyter/nbconfig
    notebook section
      jupyterlab-plotly/extension  enabled 
      - Validating: problems found:
        - require?  X jupyterlab-plotly/extension
  config dir: /etc/jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
JupyterLab v3.2.3
/usr/share/jupyter/labextensions
        jupyter-matplotlib v0.10.2 enabled OK
@martinRenou
Copy link
Member

Are you using Jupyter Notebook or JupyterLab?

@fwsmit
Copy link
Author

fwsmit commented Nov 22, 2021

I'm using jupyter notebook

@martinRenou
Copy link
Member

For some reason your jupyter-matplotlib extension is not installed.

Can you try running the following and restart Jupyter Notebook:

jupyter nbextension install --py --sys-prefix --overwrite ipympl
jupyter nbextension enable --py --sys-prefix ipympl

@fwsmit
Copy link
Author

fwsmit commented Nov 22, 2021

For some reason your jupyter-matplotlib extension is not installed.

Can you try running the following and restart Jupyter Notebook:

jupyter nbextension install --py --sys-prefix --overwrite ipympl
jupyter nbextension enable --py --sys-prefix ipympl

Thanks for the pointer, that works. Although I prefer to install packages with my own package manager. If you want, you can take a look below and try to see what's wrong with the package, but otherwise, thanks for helping!

I did install it using the AUR (Arch User Repostory). It might be that that build scripts doesn't work correctly. I'm not too familiar with jupyter extensions, but there is a (symlinked) directory jupyter-matplotlib in /usr/share/jupyter/nbextensions, next to jupyter-js-widgets (which does get recognized).

> tree
├── jupyter-js-widgets
│   ├── extension.js
│   └── extension.js.map
└── jupyter-matplotlib -> /usr/lib/python3.9/site-packages/ipympl/nbextension
> ls /usr/lib/python3.9/site-packages/ipympl/nbextension
extension.js  index.js  index.js.map
The whole file list of the package

python-ipympl /usr/
python-ipympl /usr/lib/
python-ipympl /usr/lib/python3.9/
python-ipympl /usr/lib/python3.9/site-packages/
python-ipympl /usr/lib/python3.9/site-packages/ipympl-0.8.2-py3.9.egg-info/
python-ipympl /usr/lib/python3.9/site-packages/ipympl-0.8.2-py3.9.egg-info/PKG-INFO
python-ipympl /usr/lib/python3.9/site-packages/ipympl-0.8.2-py3.9.egg-info/SOURCES.txt
python-ipympl /usr/lib/python3.9/site-packages/ipympl-0.8.2-py3.9.egg-info/dependency_links.txt
python-ipympl /usr/lib/python3.9/site-packages/ipympl-0.8.2-py3.9.egg-info/not-zip-safe
python-ipympl /usr/lib/python3.9/site-packages/ipympl-0.8.2-py3.9.egg-info/requires.txt
python-ipympl /usr/lib/python3.9/site-packages/ipympl-0.8.2-py3.9.egg-info/top_level.txt
python-ipympl /usr/lib/python3.9/site-packages/ipympl/
python-ipympl /usr/lib/python3.9/site-packages/ipympl/init.py
python-ipympl /usr/lib/python3.9/site-packages/ipympl/pycache/
python-ipympl /usr/lib/python3.9/site-packages/ipympl/pycache/init.cpython-39.opt-1.pyc
python-ipympl /usr/lib/python3.9/site-packages/ipympl/pycache/init.cpython-39.pyc
python-ipympl /usr/lib/python3.9/site-packages/ipympl/pycache/_version.cpython-39.opt-1.pyc
python-ipympl /usr/lib/python3.9/site-packages/ipympl/pycache/_version.cpython-39.pyc
python-ipympl /usr/lib/python3.9/site-packages/ipympl/pycache/backend_nbagg.cpython-39.opt-1.pyc
python-ipympl /usr/lib/python3.9/site-packages/ipympl/pycache/backend_nbagg.cpython-39.pyc
python-ipympl /usr/lib/python3.9/site-packages/ipympl/_version.py
python-ipympl /usr/lib/python3.9/site-packages/ipympl/backend_nbagg.py
python-ipympl /usr/lib/python3.9/site-packages/ipympl/labextension/
python-ipympl /usr/lib/python3.9/site-packages/ipympl/labextension/package.json
python-ipympl /usr/lib/python3.9/site-packages/ipympl/labextension/static/
python-ipympl /usr/lib/python3.9/site-packages/ipympl/labextension/static/108.8df18ff2c29122b918e8.js
python-ipympl /usr/lib/python3.9/site-packages/ipympl/labextension/static/480.a718194c5d9dc795dc1d.js
python-ipympl /usr/lib/python3.9/site-packages/ipympl/labextension/static/686.8ed886affcbd6911e0d4.js
python-ipympl /usr/lib/python3.9/site-packages/ipympl/labextension/static/remoteEntry.3833234e53759d10995a.js
python-ipympl /usr/lib/python3.9/site-packages/ipympl/labextension/static/style.js
python-ipympl /usr/lib/python3.9/site-packages/ipympl/labextension/static/third-party-licenses.json
python-ipympl /usr/lib/python3.9/site-packages/ipympl/nbextension/
python-ipympl /usr/lib/python3.9/site-packages/ipympl/nbextension/extension.js
python-ipympl /usr/lib/python3.9/site-packages/ipympl/nbextension/index.js
python-ipympl /usr/lib/python3.9/site-packages/ipympl/nbextension/index.js.map
python-ipympl /usr/share/
python-ipympl /usr/share/jupyter/
python-ipympl /usr/share/jupyter/labextensions/
python-ipympl /usr/share/jupyter/labextensions/jupyter-matplotlib
python-ipympl /usr/share/jupyter/nbextensions/
python-ipympl /usr/share/jupyter/nbextensions/jupyter-matplotlib
python-ipympl /usr/share/licenses/
python-ipympl /usr/share/licenses/python-ipympl/
python-ipympl /usr/share/licenses/python-ipympl/LICENSE

@fwsmit fwsmit closed this as completed Nov 22, 2021
@martinRenou
Copy link
Member

Although I prefer to install packages with my own package manager

Unfortunately it seems the python-ipympl package does not work in the AUR.

but there is a (symlinked) directory

Where does it link to?

I can only suggest using the conda-forge package, or the pip package, that we maintain.

@fwsmit
Copy link
Author

fwsmit commented Nov 22, 2021

Allright, thank you. I'll contact the maintainers of the AUR package and use the jupyter one for now :)

@zhanjiahui
Copy link

For some reason your jupyter-matplotlib extension is not installed.

Can you try running the following and restart Jupyter Notebook:

jupyter nbextension install --py --sys-prefix --overwrite ipympl
jupyter nbextension enable --py --sys-prefix ipympl

Sorry to ask where should I running the above commands? Should i try it in my conda envirment? I get this results and there is still no plots shown in my jupyter notebook cell:
图片

@fwsmit
Copy link
Author

fwsmit commented Jan 5, 2022

Sorry to ask where should I running the above commands? Should i try it in my conda envirment? I get this results and there is still no plots shown in my jupyter notebook cell:

If you're using anaconda, you should probably use the conda package manager: https://anaconda.org/conda-forge/ipympl

@specter119
Copy link

@fwsmit try https://gist.github.com/specter119/721e2ac5a0e54a19978326037271d4dd
the aur maintainer miss a json file.
the extension can be seen in the jupyter nbextension list

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

No branches or pull requests

4 participants