Skip to content
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

%matplotlib widget not working in jupyter lab #148

Closed
hasibzunair opened this issue Oct 27, 2019 · 7 comments
Closed

%matplotlib widget not working in jupyter lab #148

hasibzunair opened this issue Oct 27, 2019 · 7 comments

Comments

@hasibzunair
Copy link

Running a cell in jupyter lab with %matplotlib widget results in:

Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …
Running the cell more than once results in:

KeyError: '97acd0c8fb504a2288834b349003b4ae'

My environment:

  • Python 3.6.8
  • Matplotlib 3.0.3
@martinRenou
Copy link
Member

What instructions did you follow for installing ipympl?

@hasibzunair
Copy link
Author

hasibzunair commented Oct 28, 2019

Just pip install ipympl.

It works now after running the following bash commands.

conda install -y nodejs
pip install --upgrade jupyterlab
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyter-matplotlib
jupyter nbextension enable --py widgetsnbextension

Edit: Must restart jupyter server after running these commands

@Nestak2
Copy link

Nestak2 commented Jan 18, 2020

Thanks, "restart" was the critical instruction for me. It wasn't enough the quit and start again jupyterlab in the terminal, only after restarting the computer the plots finally worked

@martinRenou
Copy link
Member

Usually clearing the browser cache is the important step

@RGD2
Copy link

RGD2 commented Jun 22, 2020

FWIW I had same problem, but had to avoid using conda, and was required to use virtual envs with python.
I was able to fix this by following nodejs's install instructions using a package manager. In my case this was ubuntu -- so using nodejs binary distributions from github.

This ended up being something like (in total):

mkvirtualenv -p python3.8 jupenv
pip install jupyter matplotlib pandas ipympl tqdm
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
jupyter labextension install @jupyter-widgets/jupyterlab-manager

Because of the venv, you later start jupyter with:

workon jupenv
jupyter lab

Hope this helps others.

orena1 added a commit to orena1/ipympl that referenced this issue Nov 23, 2020
All of those are because they did not restart JupyterLab
matplotlib#275
matplotlib#148
matplotlib#66
matplotlib#201

Happened to me also, It might make people run back to  notebook
@Mariveros
Copy link

Same problem here, restarting kernel not work for me. only when I restart jupyter lab from terminal it works. (%matplotlib widget)

@Samadarshi-Maity
Copy link

upgrade pip
add

pip install ipympl 

in anaconda prompt
and restart jupyter notebook

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

6 participants