Skip to content

Installing plotly with ipywigets 7.5 fails to plot in jupyter lab #1659

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
samueljackson92 opened this issue Jul 8, 2019 · 15 comments
Closed

Comments

@samueljackson92
Copy link

Hi,

I noticed that if I upgrade to the latest version of ipywidgets==7.5 this breaks FigureWidget in my jupyter lab notebook (in offline mode).

The part of my docker file that install plotly looks like this:

RUN pip install plotly==3.10.0 jupyterlab==0.35 ipywidgets==7.5 psutil

# Install Jupyter Lab Extensions
# ------------------------------------------------------------------------------
RUN export NODE_OPTIONS=--max-old-space-size=4096 \
    && jupyter labextension install @jupyter-widgets/[email protected] --no-build \
    && jupyter labextension install [email protected] --no-build \
    && jupyter labextension install @jupyterlab/[email protected] --no-build \
    && jupyter lab build

I get the "Error displaying widget" message. Looking in the console gives me this error:

Uncaught (in promise) Module @jupyter-widgets/base, semver range ^1.2.0 is not registered as a widget module
vendors~main.dfdb0f7451aa8d94f759.js:460982 Error displaying widget
vendors~main.dfdb0f7451aa8d94f759.js:460983 Module @jupyter-widgets/base, semver range ^1.2.0 is not registered as a widget module

If I revert back to 7.4 then the error goes away. I only noticed this because I originally had my ipywidgets install line set to "ipywidgets>=7.2" which is what the plotly.py install instructions recommend.

@jonmmease
Copy link
Contributor

Hi @samueljackson92,

For ipywidgets 7.5 I think you'll need @jupyter-widgets/[email protected]. We'll be publishing a release candidate for plotly.py version 4 soon, and that will include instructions for JupyterLab 1.0 and ipywidgets 7.5. Stay tuned.

@SylvainCorlay
Copy link

@jonmmease you should be able to publish a patch release on the latest stable changing the jupyterlab-manager requirement from ^1.x to ^1.x || ^2.0.

@murison
Copy link

murison commented Jul 17, 2019

Any updates on this? 7.5 is still broken...

@jonmmease
Copy link
Contributor

Hi all, yesterday we released version 4.0.0 of the plotly package which has support for ipywidgets 7.5 when used with JupyterLab 1.0. See https://plot.ly/python/getting-started/ for installation instructions. Thanks!

@flixr
Copy link

flixr commented Jul 26, 2019

Any chance on a patch release for 3.x with the changes @SylvainCorlay suggested?

@jonmmease
Copy link
Contributor

Hi @flixr,

[email protected] with jupyterlab==1.0 should work with plotly 3.10 as well as 4.0.

@hoangthienan95
Copy link

If you are seeing this after today, are using plotly 4 and followed everything (https://plot.ly/python/getting-started/ and https://github.com/plotly/plotly.py) and it's still not working, upgrading to [email protected] worked for me when [email protected] didn't

@mazzma12
Copy link

If you are seeing this after today, are using plotly 4 and followed everything (https://plot.ly/python/getting-started/ and https://github.com/plotly/plotly.py) and it's still not working, upgrading to [email protected] worked for me when [email protected] didn't

I followed the getting started in fresh conda env, but the widget is still not displayed :

image

anaconda3-2019.07 ❯ jupyter labextension list                                  
JupyterLab v1.0.9                                                              
Known labextensions:                                                           
   app dir: /home/matthieu/.pyenv/versions/anaconda3-2019.07/share/jupyter/lab 
        @jupyter-widgets/jupyterlab-manager v1.0.2  enabled  OK                
        jupyterlab-chart-editor v1.2.0  enabled  OK                            
        jupyterlab-plotly v1.1.0  enabled  OK                                  
        plotlywidget v1.1.0  enabled  OK                                       

@LuisFRoch
Copy link

@mazzma12 What i've noticed is that when you install in a new env, the install pulls from existing files and/or versions previously installed.
My solution has been deleting all (time consuming but faster than checking Java console, etc and figuring what went wrong) existing ana/miniconda, Jlab files, widgets, bqplot, etc., and installing an older version e.g. plotly 3.8.1. and jupyterlab==0.35 / 1.0.1.

@mazzma12
Copy link

Thanks, but I need plotly 4 and jupyterlab v1.

I eventually got it working by removing the version specifications mentioned in the readme. I end up with these versions.

anaconda3-2019.07 ❯ jupyter labextension list
JupyterLab v1.0.9
Known labextensions:
   app dir: /home/matthieu/.pyenv/versions/anaconda3-2019.07/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v1.0.2  enabled  OK
        @jupyterlab/toc v1.0.1  enabled  OK
        jupyterlab-chart-editor v1.2.0  enabled  OK
        jupyterlab-plotly v1.1.2  enabled  OK
        plotlywidget v1.1.1  enabled  OK

If it appears to be a general case perhaps it would be good to update the readme @jonmmease ?

@yoonghm
Copy link
Contributor

yoonghm commented Oct 22, 2019

I can confirm that the instruction in https://plot.ly/python/getting-started/ works. However, if new version of jupyterlab is updated, plotly may break again.

@VeneficusFerox
Copy link

Mine is broken with newer versions. Even an empty FigureWidget() gives an error:

import plotly.graph_objects as go

f = go.FigureWidget()
f

Error displaying widget: model not found

I'm running:

(python36) C:\WINDOWS\system32>jupyter labextension list
JupyterLab v1.1.4
Known labextensions:
app dir: C:\ProgramData\Anaconda3\envs\python36\share\jupyter\lab
@jupyter-widgets/jupyterlab-manager v1.0.3 enabled ok
@jupyterlab/toc v1.0.1 enabled ok
@krassowski/jupyterlab_go_to_definition v0.7.1 enabled ok
@yeebc/jupyterlab_neon_theme v1.0.3 enabled ok
jupyterlab-dash v0.1.0-alpha.3 enabled ok
jupyterlab-plotly v1.2.0 enabled ok
jupyterlab-theme-toggle v0.4.2 enabled ok
plotlywidget v1.2.0 enabled ok

@wabiloo
Copy link

wabiloo commented Mar 27, 2020

Aarg... I have the same problem. Again!
I had it working for a couple of months in a docker image, but on rebuilding it today (because I changed a line of the DockerFile that was completely unrelated), I now get the same issue.
I've also tried upgrading the extensions in line with https://plotly.com/python/getting-started/#jupyterlab-support-python-35, but I still have the same error:
Error displaying widget: model not found

The Jupyter code is similar to @VeneficusFerox :

import plotly.graph_objects as go

f = go.FigureWidget()
f

I'm running:

JupyterLab v1.2.0
Known labextensions:
   app dir: /usr/local/share/jupyter/lab
        @aquirdturtle/collapsible_headings v0.5.0  enabled  OK
        @jupyter-widgets/jupyterlab-manager v1.1.0  enabled  OK
        @jupyterlab/toc v2.0.0  enabled  OK
        jupyterlab-plotly v1.5.4  enabled  OK
        jupyterlab-python-file v0.3.0  enabled  OK
        plotlywidget v1.5.4  enabled  OK

My docker file contains:


ENV NODE_OPTIONS=--max-old-space-size=4096 
RUN jupyter labextension install @jupyter-widgets/[email protected] --no-build \
    && jupyter labextension install [email protected] --no-build \
    && jupyter labextension install [email protected] --no-build \
    && jupyter labextension install @aquirdturtle/collapsible_headings --no-build \
    && jupyter labextension install @jupyterlab/toc --no-build \
    && jupyter labextension install jupyterlab-python-file --no-build \
    && jupyter lab build

Previously it was


ENV NODE_OPTIONS=--max-old-space-size=4096 
RUN jupyter labextension install @jupyter-widgets/[email protected] --no-build \
    && jupyter labextension install [email protected] --no-build \
    && jupyter labextension install [email protected] --no-build \
    && jupyter labextension install @aquirdturtle/collapsible_headings --no-build \
    && jupyter labextension install @jupyterlab/toc --no-build \
    && jupyter labextension install jupyterlab-python-file --no-build \
    && jupyter lab build

@murison
Copy link

murison commented Mar 28, 2020 via email

@nicolaskruchten
Copy link
Contributor

If you're encountering issues like this, please check out our troubleshooting guide at https://plotly.com/python/troubleshooting/ and if that's not enough to get you unstuck, please create a new issue.

Please pay close attention to the versions: you must have corresponding versions of JupyterLab, the extension-manager and both Plotly extensions as well as the Plotly.py version for things to work. If you simply upgrade the Plotly.py version and try to run with older extensions, you will see Error displaying widget: model not found and ditto if you upgrade the extensions but not Plotly.py.

@plotly plotly locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests