plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
16.11k stars 2.54k forks source link

ipywidgets not working in Python 2.7 #1040

Closed Kully closed 6 years ago

Kully commented 6 years ago

re: https://github.com/plotly/plotly.py/pull/942

Issue: FigureWidget is not showing up in the python 2.7 notebook.

plotly venv: python 2.7.12.


jupyter labextension list

output is:

JupyterLab v0.32.1
Known labextensions:
   app dir: /Library/Frameworks/Python.framework/Versions/2.7/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager
        @jupyter-widgets/jupyterlab-manager v0.35.0  enabled  OK
plotlywidget
        plotlywidget v0.1.0  enabled  OK

and

jupyter nbextension list output is:

Known nbextensions:
  config dir: /Users/adamkulidjian/.jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
  config dir: /Library/Frameworks/Python.framework/Versions/2.7/etc/jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled 
      - Validating: OK

pip list returns:

Package                                Version    
-------------------------------------- -----------
aem-cmd                                0.14.5     
altgraph                               0.14       
ansible                                2.4.1.0    
appdirs                                1.4.3      
appnope                                0.1.0      
appscript                              1.0.1      
asn1crypto                             0.24.0     
astroid                                1.5.3      
atomicfile                             1.0        
backports-abc                          0.5        
backports.functools-lru-cache          1.5        
backports.shutil-get-terminal-size     1.0.0      
basemap                                1.0.7      
bcrypt                                 3.1.4      
bdist-mpkg                             0.5.0      
beautifulsoup4                         4.5.3      
bleach                                 2.0.0      
bonjour-py                             0.3        
boto                                   2.48.0     
bs4                                    0.0.1      
bundle                                 1.1.2      
certifi                                2018.4.16  
cffi                                   1.11.4     
chardet                                3.0.4      
click                                  6.7        
click-plugins                          1.0.3      
cligj                                  0.4.0      
cmocean                                1.1        
colorlover                             0.2.1      
configparser                           3.5.0      
cryptography                           2.1.4      
cufflinks                              0.8.2      
cx-Freeze                              5.0.2      
cycler                                 0.10.0     
dash-core-components                   0.5.0      
dash-html-components                   0.6.0      
dash-renderer                          0.7.0      
dash.ly                                0.17.0     
dask                                   0.11.0     
decorator                              4.3.0      
descartes                              1.1.0      
entrypoints                            0.2.2      
enum34                                 1.1.6      
eyeD3                                  0.8.4      
feather-format                         0.4.0      
finsymbols                             1.1.1      
Fiona                                  1.7.11     
flake8                                 3.5.0      
Flask                                  0.12.2     
Flask-Caching                          1.2.0      
Flask-Compress                         1.4.0      
Flask-Cors                             3.0.2      
Flask-SeaSurf                          0.2.2      
funcsigs                               1.0.2      
functools32                            3.2.3.post2
futures                                3.2.0      
geopandas                              0.3.0      
gi                                     1.2        
googlemaps                             2.4.4      
gunicorn                               19.6.0     
html5lib                               0.999999999
idna                                   2.6        
igraph                                 0.1.11     
ipaddress                              1.0.19     
ipdb                                   0.11       
ipykernel                              4.6.1      
ipython                                5.3.0      
ipython-genutils                       0.2.0      
ipywidgets                             6.0.0      
isort                                  4.2.15     
itsdangerous                           0.24       
jgraph                                 0.2.1      
Jinja2                                 2.10       
jsonschema                             2.6.0      
jupyter                                1.0.0      
jupyter-client                         5.0.1      
jupyter-console                        5.1.0      
jupyter-core                           4.4.0      
jupyterlab                             0.32.1     
jupyterlab-launcher                    0.10.5     
keyring                                12.2.1     
keyrings.alt                           3.1        
kiwisolver                             1.0.1      
latexcodec                             1.0.3      
lazy-object-proxy                      1.3.1      
lmfit                                  0.9.5      
lxml                                   4.1.1      
macholib                               1.8        
MarkupSafe                             1.0        
matplotlib                             2.2.2      
mccabe                                 0.6.1      
mistune                                0.7.4      
mock                                   2.0.0      
modulegraph                            0.15       
monty                                  0.9.5      
mpl-finance                            0.10.0     
munch                                  2.2.0      
nbconvert                              5.2.1      
nbformat                               4.4.0      
ndg-httpsclient                        0.4.4      
netCDF4                                1.3.1      
networkx                               1.11       
nose                                   1.3.7      
notebook                               5.0.0      
numpy                                  1.14.3     
OSR                                    0.0.1      
packaging                              16.8       
pandas                                 0.21.0     
pandas-datareader                      0.5.0      
pandocfilters                          1.4.1      
paramiko                               2.3.1      
pathlib                                1.0.1      
pathlib2                               2.2.1      
patsy                                  0.5.0      
pbr                                    4.0.1      
PeakUtils                              1.0.3      
pep8                                   1.7.0      
pexpect                                4.2.1      
pickleshare                            0.7.4      
Pillow                                 3.3.1      
pip                                    10.0.1     
pisa                                   3.0.33     
pkginfo                                1.4.2      
plotly                                 3.0.0rc9   
plotlyhtmlexporter                     0.0.1      
plyfile                                0.5        
prompt-toolkit                         1.0.14     
psutil                                 5.4.6      
psycopg2                               2.7.4      
ptyprocess                             0.5.1      
publisher                              0.11       
py2app                                 0.14       
pyarrow                                0.8.0      
pyasn1                                 0.3.7      
pybtex                                 0.20.1     
pycodestyle                            2.3.1      
pycparser                              2.18       
pyflakes                               1.6.0      
pygame                                 1.9.3      
pyglet                                 1.1.4      
Pygments                               2.2.0      
pylint                                 1.7.4      
pymatgen                               4.3.1      
PyNaCl                                 1.2.0      
pyobjc-core                            2.5.1      
pyobjc-framework-Accounts              2.5.1      
pyobjc-framework-AddressBook           2.5.1      
pyobjc-framework-AppleScriptKit        2.5.1      
pyobjc-framework-AppleScriptObjC       2.5.1      
pyobjc-framework-Automator             2.5.1      
pyobjc-framework-CFNetwork             2.5.1      
pyobjc-framework-Cocoa                 2.5.1      
pyobjc-framework-Collaboration         2.5.1      
pyobjc-framework-CoreData              2.5.1      
pyobjc-framework-CoreLocation          2.5.1      
pyobjc-framework-CoreText              2.5.1      
pyobjc-framework-DictionaryServices    2.5.1      
pyobjc-framework-EventKit              2.5.1      
pyobjc-framework-ExceptionHandling     2.5.1      
pyobjc-framework-FSEvents              2.5.1      
pyobjc-framework-InputMethodKit        2.5.1      
pyobjc-framework-InstallerPlugins      2.5.1      
pyobjc-framework-InstantMessage        2.5.1      
pyobjc-framework-LatentSemanticMapping 2.5.1      
pyobjc-framework-LaunchServices        2.5.1      
pyobjc-framework-Message               2.5.1      
pyobjc-framework-OpenDirectory         2.5.1      
pyobjc-framework-PreferencePanes       2.5.1      
pyobjc-framework-PubSub                2.5.1      
pyobjc-framework-QTKit                 2.5.1      
pyobjc-framework-Quartz                2.5.1      
pyobjc-framework-ScreenSaver           2.5.1      
pyobjc-framework-ScriptingBridge       2.5.1      
pyobjc-framework-SearchKit             2.5.1      
pyobjc-framework-ServiceManagement     2.5.1      
pyobjc-framework-Social                2.5.1      
pyobjc-framework-SyncServices          2.5.1      
pyobjc-framework-SystemConfiguration   2.5.1      
pyobjc-framework-WebKit                2.5.1      
pyOpenSSL                              17.5.0     
pyorbital                              1.1.1      
pyparsing                              2.2.0      
pyPdf                                  1.13       
PyPDF2                                 1.26.0     
pyproj                                 1.9.5.1    
pyshp                                  1.2.10     
python-dateutil                        2.7.3      
python-magic                           0.4.15     
pytz                                   2018.4     
PyYAML                                 3.12       
pyzmq                                  16.0.2     
qtconsole                              4.3.0      
redis                                  2.10.5     
reportlab                              3.4.0      
requests                               2.10.0     
requests-file                          1.4.2      
requests-ftp                           0.3.1      
requests-toolbelt                      0.8.0      
retrying                               1.3.3      
scandir                                1.5        
scikit-image                           0.12.3     
scikit-learn                           0.19.1     
scipy                                  1.1.0      
seaborn                                0.7.1      
setuptools                             39.2.0     
Shapely                                1.6.3      
simplegeneric                          0.8.1      
singledispatch                         3.4.0.3    
six                                    1.11.0     
sklearn                                0.0        
spglib                                 1.9.5      
SQLAlchemy                             1.2.8      
squarify                               0.3.0      
statsmodels                            0.9.0      
subprocess32                           3.5.1      
tabulate                               0.7.5      
terminado                              0.6        
testpath                               0.3.1      
toolz                                  0.8.0      
tornado                                4.5.1      
tqdm                                   4.23.4     
traitlets                              4.3.2      
twine                                  1.11.0     
urllib3                                1.22       
vboxapi                                1.0        
virtualenv                             15.1.0     
wcwidth                                0.1.7      
webencodings                           0.5.1      
Werkzeug                               0.13       
wget                                   3.2        
wheel                                  0.26.0     
widgetsnbextension                     2.0.0      
wrapt                                  1.10.11    
xarray                                 0.10.0     
xattr                                  0.6.4      
xhtml2pdf                              0.0.6      
xlwings                                0.11.8     
yapf                                   0.20.2     
yolk                                   0.4.3      
zope.interface                         4.1.1  

cc. @jmmease

jonmmease commented 6 years ago

Somehow you ended up with old versions of notebook and ipywidgets. I just updated the instructions in #942 to include version constraints.

See if that does the trick.

Kully commented 6 years ago

I ran through all of it and it did not work. In addition to the commands you wrote I also ran

export NODE_OPTIONS=--max-old-space-size=4096

which I got from https://github.com/jupyterlab/jupyterlab/issues/4325 before the

jupyter labextension install @jupyter-widgets/jupyterlab-manager

command to avoid the javascript memory heap error I was getting.

jonmmease commented 6 years ago

Are you trying in both the classic notebook and JupyterLab?

Could you dump out the same info from your original post for this new environment?

Kully commented 6 years ago

Same output: screen shot 2018-06-26 at 2 52 44 pm

pip list:

Package                                Version    
-------------------------------------- -----------
aem-cmd                                0.14.5     
altgraph                               0.14       
ansible                                2.4.1.0    
appdirs                                1.4.3      
appnope                                0.1.0      
appscript                              1.0.1      
asn1crypto                             0.24.0     
astroid                                1.5.3      
atomicfile                             1.0        
backports-abc                          0.5        
backports.functools-lru-cache          1.5        
backports.shutil-get-terminal-size     1.0.0      
basemap                                1.0.7      
bcrypt                                 3.1.4      
bdist-mpkg                             0.5.0      
beautifulsoup4                         4.5.3      
bleach                                 2.0.0      
bonjour-py                             0.3        
boto                                   2.48.0     
bs4                                    0.0.1      
bundle                                 1.1.2      
certifi                                2018.4.16  
cffi                                   1.11.4     
chardet                                3.0.4      
click                                  6.7        
click-plugins                          1.0.3      
cligj                                  0.4.0      
cmocean                                1.1        
colorlover                             0.2.1      
configparser                           3.5.0      
cryptography                           2.1.4      
cufflinks                              0.8.2      
cx-Freeze                              5.0.2      
cycler                                 0.10.0     
dash-core-components                   0.5.0      
dash-html-components                   0.6.0      
dash-renderer                          0.7.0      
dash.ly                                0.17.0     
dask                                   0.11.0     
decorator                              4.3.0      
descartes                              1.1.0      
entrypoints                            0.2.2      
enum34                                 1.1.6      
eyeD3                                  0.8.4      
feather-format                         0.4.0      
finsymbols                             1.1.1      
Fiona                                  1.7.11     
flake8                                 3.5.0      
Flask                                  0.12.2     
Flask-Caching                          1.2.0      
Flask-Compress                         1.4.0      
Flask-Cors                             3.0.2      
Flask-SeaSurf                          0.2.2      
funcsigs                               1.0.2      
functools32                            3.2.3.post2
futures                                3.2.0      
geopandas                              0.3.0      
gi                                     1.2        
googlemaps                             2.4.4      
gunicorn                               19.6.0     
html5lib                               0.999999999
idna                                   2.6        
igraph                                 0.1.11     
ipaddress                              1.0.19     
ipdb                                   0.11       
ipykernel                              4.6.1      
ipython                                5.3.0      
ipython-genutils                       0.2.0      
ipywidgets                             6.0.0      
isort                                  4.2.15     
itsdangerous                           0.24       
jgraph                                 0.2.1      
Jinja2                                 2.10       
jsonschema                             2.6.0      
jupyter                                1.0.0      
jupyter-client                         5.0.1      
jupyter-console                        5.1.0      
jupyter-core                           4.4.0      
jupyterlab                             0.32.1     
jupyterlab-launcher                    0.10.5     
keyring                                12.2.1     
keyrings.alt                           3.1        
kiwisolver                             1.0.1      
latexcodec                             1.0.3      
lazy-object-proxy                      1.3.1      
lmfit                                  0.9.5      
lxml                                   4.1.1      
macholib                               1.8        
MarkupSafe                             1.0        
matplotlib                             2.2.2      
mccabe                                 0.6.1      
mistune                                0.7.4      
mock                                   2.0.0      
modulegraph                            0.15       
monty                                  0.9.5      
mpl-finance                            0.10.0     
munch                                  2.2.0      
nbconvert                              5.2.1      
nbformat                               4.4.0      
ndg-httpsclient                        0.4.4      
netCDF4                                1.3.1      
networkx                               1.11       
nose                                   1.3.7      
notebook                               5.0.0      
numpy                                  1.14.3     
OSR                                    0.0.1      
packaging                              16.8       
pandas                                 0.21.0     
pandas-datareader                      0.5.0      
pandocfilters                          1.4.1      
paramiko                               2.3.1      
pathlib                                1.0.1      
pathlib2                               2.2.1      
patsy                                  0.5.0      
pbr                                    4.0.1      
PeakUtils                              1.0.3      
pep8                                   1.7.0      
pexpect                                4.2.1      
pickleshare                            0.7.4      
Pillow                                 3.3.1      
pip                                    10.0.1     
pisa                                   3.0.33     
pkginfo                                1.4.2      
plotly                                 3.0.0rc9   
plotlyhtmlexporter                     0.0.1      
plyfile                                0.5        
prompt-toolkit                         1.0.14     
psutil                                 5.4.6      
psycopg2                               2.7.4      
ptyprocess                             0.5.1      
publisher                              0.11       
py2app                                 0.14       
pyarrow                                0.8.0      
pyasn1                                 0.3.7      
pybtex                                 0.20.1     
pycodestyle                            2.3.1      
pycparser                              2.18       
pyflakes                               1.6.0      
pygame                                 1.9.3      
pyglet                                 1.1.4      
Pygments                               2.2.0      
pylint                                 1.7.4      
pymatgen                               4.3.1      
PyNaCl                                 1.2.0      
pyobjc-core                            2.5.1      
pyobjc-framework-Accounts              2.5.1      
pyobjc-framework-AddressBook           2.5.1      
pyobjc-framework-AppleScriptKit        2.5.1      
pyobjc-framework-AppleScriptObjC       2.5.1      
pyobjc-framework-Automator             2.5.1      
pyobjc-framework-CFNetwork             2.5.1      
pyobjc-framework-Cocoa                 2.5.1      
pyobjc-framework-Collaboration         2.5.1      
pyobjc-framework-CoreData              2.5.1      
pyobjc-framework-CoreLocation          2.5.1      
pyobjc-framework-CoreText              2.5.1      
pyobjc-framework-DictionaryServices    2.5.1      
pyobjc-framework-EventKit              2.5.1      
pyobjc-framework-ExceptionHandling     2.5.1      
pyobjc-framework-FSEvents              2.5.1      
pyobjc-framework-InputMethodKit        2.5.1      
pyobjc-framework-InstallerPlugins      2.5.1      
pyobjc-framework-InstantMessage        2.5.1      
pyobjc-framework-LatentSemanticMapping 2.5.1      
pyobjc-framework-LaunchServices        2.5.1      
pyobjc-framework-Message               2.5.1      
pyobjc-framework-OpenDirectory         2.5.1      
pyobjc-framework-PreferencePanes       2.5.1      
pyobjc-framework-PubSub                2.5.1      
pyobjc-framework-QTKit                 2.5.1      
pyobjc-framework-Quartz                2.5.1      
pyobjc-framework-ScreenSaver           2.5.1      
pyobjc-framework-ScriptingBridge       2.5.1      
pyobjc-framework-SearchKit             2.5.1      
pyobjc-framework-ServiceManagement     2.5.1      
pyobjc-framework-Social                2.5.1      
pyobjc-framework-SyncServices          2.5.1      
pyobjc-framework-SystemConfiguration   2.5.1      
pyobjc-framework-WebKit                2.5.1      
pyOpenSSL                              17.5.0     
pyorbital                              1.1.1      
pyparsing                              2.2.0      
pyPdf                                  1.13       
PyPDF2                                 1.26.0     
pyproj                                 1.9.5.1    
pyshp                                  1.2.10     
python-dateutil                        2.7.3      
python-magic                           0.4.15     
pytz                                   2018.4     
PyYAML                                 3.12       
pyzmq                                  16.0.2     
qtconsole                              4.3.0      
redis                                  2.10.5     
reportlab                              3.4.0      
requests                               2.10.0     
requests-file                          1.4.2      
requests-ftp                           0.3.1      
requests-toolbelt                      0.8.0      
retrying                               1.3.3      
scandir                                1.5        
scikit-image                           0.12.3     
scikit-learn                           0.19.1     
scipy                                  1.1.0      
seaborn                                0.7.1      
setuptools                             39.2.0     
Shapely                                1.6.3      
simplegeneric                          0.8.1      
singledispatch                         3.4.0.3    
six                                    1.11.0     
sklearn                                0.0        
spglib                                 1.9.5      
SQLAlchemy                             1.2.8      
squarify                               0.3.0      
statsmodels                            0.9.0      
subprocess32                           3.5.1      
tabulate                               0.7.5      
terminado                              0.6        
testpath                               0.3.1      
toolz                                  0.8.0      
tornado                                4.5.1      
tqdm                                   4.23.4     
traitlets                              4.3.2      
twine                                  1.11.0     
urllib3                                1.22       
vboxapi                                1.0        
virtualenv                             15.1.0     
wcwidth                                0.1.7      
webencodings                           0.5.1      
Werkzeug                               0.13       
wget                                   3.2        
wheel                                  0.26.0     
widgetsnbextension                     2.0.0      
wrapt                                  1.10.11    
xarray                                 0.10.0     
xattr                                  0.6.4      
xhtml2pdf                              0.0.6      
xlwings                                0.11.8     
yapf                                   0.20.2     
yolk                                   0.4.3      
zope.interface                         4.1.1     
Kully commented 6 years ago

And what you asked for...

  1. jupyter labextension list returns

    JupyterLab v0.32.1
    Known labextensions:
    app dir: /Library/Frameworks/Python.framework/Versions/2.7/share/jupyter/lab
    @jupyter-widgets/jupyterlab-manager
        @jupyter-widgets/jupyterlab-manager v0.35.0  enabled  OK
    plotlywidget
        plotlywidget v0.1.0  enabled  OK
  2. jupyter nbextension list returns

    
    Known nbextensions:
    config dir: /Users/adamkulidjian/.jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
    config dir: /Library/Frameworks/Python.framework/Versions/2.7/etc/jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
      plotlywidget/extension  enabled 
      - Validating: OK
jonmmease commented 6 years ago

Hmm, your versions of ipywidgets and notebook are still too old. You have ipywidgets 6.0.0 and you need >=7.2 . And you have notebook 5.0 and you need >=5.3.

Maybe start over and check the versions of these two libraries after each step to see if something is causing them to be downgraded. Also, I just added double quotes around the libraries in the install command in case the > characters were messing things up.

pip install "notebook>=5.3" "ipywidgets>=7.2"
Kully commented 6 years ago

Excellent, that was indeed the issue. The correct versions have been installed and it is working now. Thank you!

jonmmease commented 6 years ago

Awesome!

frederico-klein commented 3 years ago

(From another thread) I did:

 pip install -U pip setuptools twine

and then another

pip install ipywidgets

And it worked.