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

compatibility with Jupyterlab-0.33.0rc0 ? #2850

Closed
stonebig opened this issue Jun 30, 2018 · 24 comments
Closed

compatibility with Jupyterlab-0.33.0rc0 ? #2850

stonebig opened this issue Jun 30, 2018 · 24 comments
Assignees

Comments

@stonebig
Copy link
Contributor

# Holoviews
# for more example, see http://holoviews.org/Tutorials/index.html
import numpy as np
import holoviews as hv
hv.extension('matplotlib')
dots = np.linspace(-0.45, 0.45, 11)
fractal = hv.Image(image)

layouts = {y: (fractal * hv.Points(fractal.sample([(i,y) for i in dots])) +
               fractal.sample(y=y) )
            for y in np.linspace(0, 0.45,11)}

hv.HoloMap(layouts, kdims=['Y']).collate().cols(2)

I get this problem, not sure if it's a holoviews-0.11.6 compatibility probem:
image

@stonebig
Copy link
Contributor Author

the other one is also struggling, maybe not same type of problem:

# Datashader (holoviews+Bokeh)
import numpy as np
import pandas as pd
import holoviews as hv
import datashader as ds
from holoviews.operation.datashader import aggregate, shade, datashade, dynspread
from bokeh.models import DatetimeTickFormatter
hv.extension('bokeh')

def time_series(T = 1, N = 100, mu = 0.1, sigma = 0.1, S0 = 20):  
    """Parameterized noisy time series"""
    dt = float(T)/N
    t = np.linspace(0, T, N)
    W = np.random.standard_normal(size = N) 
    W = np.cumsum(W)*np.sqrt(dt) # standard brownian motion
    X = (mu-0.5*sigma**2)*t + sigma*W 
    S = S0*np.exp(X) # geometric brownian motion
    return S

def apply_formatter(plot, element):
    plot.handles['xaxis'].formatter = DatetimeTickFormatter()
    
drange = pd.date_range(start="2014-01-01", end="2016-01-01", freq='1D') # or '1min'
dates = drange.values.astype('int64')/10**6 # Convert dates to ints
curve = hv.Curve((dates, time_series(N=len(dates), sigma = 1)))
%%opts RGB [finalize_hooks=[apply_formatter] width=800]
%%opts Overlay [finalize_hooks=[apply_formatter] width=800] 
%%opts Scatter [tools=['hover', 'box_select']] (line_color="black" fill_color="red" size=10)

from holoviews.operation.timeseries import rolling, rolling_outlier_std
smoothed = rolling(curve, rolling_window=50)
outliers = rolling_outlier_std(curve, rolling_window=50, sigma=2)
datashade(curve, cmap=["blue"]) * dynspread(datashade(smoothed, cmap=["red"]),max_px=1) * outliers

gives:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\IPython\core\formatters.py in __call__(self, obj, include, exclude)
    968 
    969             if method is not None:
--> 970                 return method(include=include, exclude=exclude)
    971             return None
    972         else:

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\core\dimension.py in _repr_mimebundle_(self, include, exclude)
   1226         combined and returned.
   1227         """
-> 1228         return Store.render(self)
   1229 
   1230 

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\core\options.py in render(cls, obj)
   1287         data, metadata = {}, {}
   1288         for hook in hooks:
-> 1289             d, md = hook(obj)
   1290             data.update(d)
   1291             metadata.update(md)

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\ipython\display_hooks.py in pprint_display(obj)
    276     if not ip.display_formatter.formatters['text/plain'].pprint:
    277         return None
--> 278     return display(obj, raw=True)
    279 
    280 

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\ipython\display_hooks.py in display(obj, raw, **kwargs)
    253     elif isinstance(obj, (HoloMap, DynamicMap)):
    254         with option_state(obj):
--> 255             output = map_display(obj)
    256     elif isinstance(obj, Plot):
    257         output = render(obj)

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\ipython\display_hooks.py in wrapped(element)
    140         try:
    141             max_frames = OutputSettings.options['max_frames']
--> 142             mimebundle = fn(element, max_frames=max_frames)
    143             if mimebundle is None:
    144                 return {}, {}

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\ipython\display_hooks.py in map_display(vmap, max_frames)
    208         return None
    209 
--> 210     return render(vmap)
    211 
    212 

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\ipython\display_hooks.py in render(obj, **kwargs)
     63         renderer = renderer.instance(fig='png')
     64 
---> 65     return renderer.components(obj, **kwargs)
     66 
     67 

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\plotting\bokeh\renderer.py in components(self, obj, fmt, comm, **kwargs)
    248         # Bokeh has to handle comms directly in <0.12.15
    249         comm = False if bokeh_version < '0.12.15' else comm
--> 250         return super(BokehRenderer, self).components(obj,fmt, comm, **kwargs)
    251 
    252 

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\plotting\renderer.py in components(self, obj, fmt, comm, **kwargs)
    319             plot = obj
    320         else:
--> 321             plot, fmt = self._validate(obj, fmt)
    322 
    323         widget_id = None

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\plotting\renderer.py in _validate(self, obj, fmt, **kwargs)
    218         if isinstance(obj, tuple(self.widgets.values())):
    219             return obj, 'html'
--> 220         plot = self.get_plot(obj, renderer=self, **kwargs)
    221 
    222         fig_formats = self.mode_formats['fig'][self.mode]

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\plotting\bokeh\renderer.py in get_plot(self_or_cls, obj, doc, renderer)
    149             doc = Document() if self_or_cls.notebook_context else curdoc()
    150         doc.theme = self_or_cls.theme
--> 151         plot = super(BokehRenderer, self_or_cls).get_plot(obj, renderer)
    152         plot.document = doc
    153         return plot

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\plotting\renderer.py in get_plot(self_or_cls, obj, renderer)
    205             init_key = tuple(v if d is None else d for v, d in
    206                              zip(plot.keys[0], defaults))
--> 207             plot.update(init_key)
    208         else:
    209             plot = obj

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\plotting\plot.py in update(self, key)
    506     def update(self, key):
    507         if len(self) == 1 and ((key == 0) or (key == self.keys[0])) and not self.drawn:
--> 508             return self.initialize_plot()
    509         item = self.__getitem__(key)
    510         self.traverse(lambda x: setattr(x, '_updated', True))

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\plotting\bokeh\element.py in initialize_plot(self, ranges, plot, plots)
   1385             frame = None
   1386             if self.tabs: subplot.overlaid = False
-> 1387             child = subplot.initialize_plot(ranges, plot, plots)
   1388             if isinstance(element, CompositeOverlay):
   1389                 frame = element.get(key, None)

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\plotting\bokeh\element.py in initialize_plot(self, ranges, plot, plots, source)
    724         self.handles['plot'] = plot
    725 
--> 726         self._init_glyphs(plot, element, ranges, source)
    727         if not self.overlaid:
    728             self._update_plot(key, plot, style_element)

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\plotting\bokeh\element.py in _init_glyphs(self, plot, element, ranges, source)
    689             self.handles['glyph_renderer'] = renderer
    690 
--> 691         self._postprocess_hover(renderer, source)
    692 
    693         # Update plot, source and glyph

C:\WinP\bd36\buPs2\winp64-3.6.x.1\python-3.6.5.amd64\lib\site-packages\holoviews\plotting\bokeh\element.py in _postprocess_hover(self, renderer, source)
    653         if hover is None:
    654             return
--> 655         hover.renderers.append(renderer)
    656 
    657         # If datetime column is in the data replace hover formatter

AttributeError: 'str' object has no attribute 'append'

@philippjfr
Copy link
Member

Thanks, I'll have to look into the JLab issue. For the other issue could you report the versions of HoloViews and Bokeh? holoviews-0.11.6 does not exist.

@ea42gh
Copy link
Contributor

ea42gh commented Jul 1, 2018

tried the code with an image. Found it works with
Jupyterlab Version 0.32.1, holoviews version 1.10.6.post1+ga14c621e

@stonebig
Copy link
Contributor Author

stonebig commented Jul 1, 2018

typo: I meant fresh holoviews-1.10.6 (official release)

@stonebig
Copy link
Contributor Author

stonebig commented Jul 1, 2018

on a full rebuild:

  • at start jupyterlab-0.33.0rc0 (but jupyterlab-0.32.1 also) tells my jupyterlab_holoview is already registered (don't catch the meaning)
    image

  • then now:
    . initial "'ui' undefined" is still there,
    . but second error is quite different:
    . a floating intearctive image (outside of up-down moving of the notebook cells), without the big outlier dots,
    . a sort of summary at the bottom of the cell, where I should expect the image:
    image

pip list:

Package                  Version      
------------------------ -------------
adodbapi                 2.6.0.7      
alabaster                0.7.11       
algopy                   0.5.7        
altair                   2.1.0        
altair-widgets           0.1.2        
appdirs                  1.4.3        
asciitree                0.3.3        
asteval                  0.9.12       
astroid                  1.6.5        
astroML                  0.3          
atomicwrites             1.1.5        
attrs                    18.1.0       
Babel                    2.6.0        
backcall                 0.1.0        
backports-abc            0.5          
baresql                  0.7.4        
bcolz                    1.2.1        
beautifulsoup4           4.6.0        
blaze                    0.10.1       
bleach                   2.1.3        
blosc                    1.5.1        
bloscpack                0.11.0       
bokeh                    0.13.0       
Bottleneck               1.2.1        
bqplot                   0.10.5       
brewer2mpl               1.4.1        
Brotli                   1.0.4        
certifi                  2018.4.16    
cffi                     1.11.5       
cftime                   1.0.0        
chardet                  3.0.4        
click                    6.7          
cloudpickle              0.5.3        
colorama                 0.3.9        
colorcet                 0.9.1        
comtypes                 1.1.4        
cvxopt                   1.2.0        
cvxpy                    1.0.6        
cx-Freeze                5.1.1        
cycler                   0.10.0       
Cython                   0.28.3       
cytoolz                  0.9.0.1      
dask                     0.18.1       
dask-searchcv            0.2.0        
datashader               0.6.6        
datashape                0.5.2        
db.py                    0.5.3        
decorator                4.3.0        
dill                     0.2.8.2      
distributed              1.22.0       
docopt                   0.6.2        
docrepr                  0.1.1        
docutils                 0.14         
ecos                     2.0.5        
edward                   1.3.5        
emcee                    2.2.1        
entrypoints              0.2.3        
fast-histogram           0.4          
fastcache                1.0.2        
fasteners                0.14.1       
fastparquet              0.1.5        
Flask                    1.0.2        
Flask-Cors               3.0.6        
formlayout               1.1.0        
future                   0.16.0       
fuzzywuzzy               0.16.0       
geographiclib            1.49         
geopy                    1.14.0       
gmpy2                    2.0.8        
greenlet                 0.4.13       
guidata                  1.7.6        
h5py                     2.8.0        
HeapDict                 1.0.0        
holoplot                 0.1.0        
holoviews                1.10.6       
html5lib                 1.0.1        
husl                     4.0.3        
idna                     2.7          
imageio                  2.3.0        
imagesize                1.0.0        
intake                   0.1.3        
ipydatawidgets           3.1.0        
ipykernel                4.8.2        
ipyleaflet               0.8.4        
ipympl                   0.1.1        
ipyparallel              6.2.1        
ipyscales                0.1.3        
ipython                  6.4.0        
ipython-genutils         0.2.0        
ipython-sql              0.3.9        
ipywidgets               7.2.1        
isort                    4.3.4        
itsdangerous             0.24         
jedi                     0.12.1       
Jinja2                   2.10         
joblib                   0.12.0       
jsonschema               2.6.0        
julia                    0.1.5        
jupyter                  1.0.0        
jupyter-client           5.2.3        
jupyter-console          5.2.0        
jupyter-core             4.4.0        
jupyter-sphinx           0.1.2        
jupyterlab               0.33.0rc0    
jupyterlab-launcher      0.11.0       
Keras                    2.2.0        
Keras-Applications       1.0.2        
Keras-Preprocessing      1.0.1        
keras-vis                0.4.1        
keyring                  13.1.0       
kiwisolver               1.0.1        
lazy-object-proxy        1.3.1        
llvmlite                 0.23.2       
lmfit                    0.9.10       
locket                   0.2.0        
loky                     2.1.1        
lxml                     4.2.3        
Markdown                 2.6.11       
MarkupSafe               1.0          
matplotlib               2.2.2        
mccabe                   0.6.1        
metakernel               0.20.14      
mistune                  0.8.3        
mizani                   0.4.6        
mkl-service              1.1.2        
monotonic                1.5          
more-itertools           4.2.0        
moviepy                  0.2.3.5      
mpl-scatter-density      0.3          
mpld3                    0.3          
mpldatacursor            0.6.2        
mpmath                   1.0.0        
msgpack                  0.5.6        
msgpack-numpy            0.4.3        
msgpack-python           0.5.4+dummy  
multipledispatch         0.5.0        
multiprocess             0.70.6.1     
mysql-connector-python   8.0.6        
nbconvert                5.3.1        
nbconvert-reportlab      0.2          
nbformat                 4.4.0        
netCDF4                  1.4.0        
networkx                 2.1          
nltk                     3.3          
notebook                 5.5.0        
numba                    0.38.1       
numcodecs                0.5.5        
numdifftools             0.9.20       
numexpr                  2.6.5        
numpy                    1.14.5+mkl   
numpydoc                 0.8.0        
oct2py                   4.0.6        
octave-kernel            0.28.3       
odo                      0.5.0        
osqp                     0.3.0        
packaging                17.1         
palettable               3.1.1        
pandas                   0.23.1       
pandas-datareader        0.6.0        
pandocfilters            1.4.2        
param                    1.7.0        
parambokeh               0.2.2        
paramnb                  2.0.2        
parso                    0.3.0        
partd                    0.3.8        
patsy                    0.5.0        
pdfrw                    0.4          
pdvega                   0.1          
pep8                     1.7.1        
pexpect                  4.6.0+dummy  
pg8000                   1.11.0       
pickleshare              0.7.4        
Pillow                   5.1.1        
pip                      10.0.1       
pkginfo                  1.4.2        
plotnine                 0.3.0        
pluggy                   0.6.0        
prettytable              0.7.2        
prompt-toolkit           1.0.15       
psutil                   5.4.6        
ptpython                 0.41         
PuLP                     1.6.8        
py                       1.5.3        
PyAudio                  0.2.11       
pybars3                  0.9.3        
pybind11                 2.2.3        
pycodestyle              2.4.0        
pycparser                2.17         
pyct                     0.4.2        
pyflakes                 2.0.0        
pyflux                   0.4.17       
pygame                   1.9.3        
Pygments                 2.2.0        
pylint                   1.9.2        
pymc                     2.3.7        
pymc3                    3.4.1        
PyMeta3                  0.5.1        
pymongo                  3.7.0        
pyodbc                   4.0.23       
PyOpenGL                 3.1.2        
pypandoc                 1.3.2        
pyparsing                2.2.0        
PyQt5                    5.9.2        
pyqtgraph                0.11.0.dev0  
pyserial                 3.4          
pystache                 0.5.4        
pytest                   3.6.2        
python-dateutil          2.7.3        
python-hdf4              0.9.1        
python-Levenshtein       0.12.0       
python-snappy            0.5.2        
PythonQwt                0.5.5        
pythreejs                1.0.0        
pytz                     2018.4       
pyviz-comms              0.1.1        
PyWavelets               0.5.2        
pywin32                  223.1        
pywin32-ctypes           0.1.2        
pywinpty                 0.5.4        
pywinusb                 0.4.2        
PyYAML                   4.1          
pyzmq                    17.0.0       
pyzo                     4.5.2        
QtAwesome                0.5.0.dev0   
qtconsole                4.3.1        
QtPy                     1.4.2        
redis                    2.10.6       
regex                    2018.6.21    
reportlab                3.4.0        
requests                 2.19.1       
requests-file            1.4.3        
requests-ftp             0.3.1        
requests-toolbelt        0.8.0        
rope                     0.10.7       
rpy2                     2.9.4        
ruamel.yaml              0.15.41      
Rx                       1.6.1        
scikit-fuzzy             0.3.1        
scikit-image             0.14.0       
scikit-learn             0.19.1       
scikit-optimize          0.5.2        
scilab2py                0.6.1        
scipy                    1.1.0        
scs                      1.2.7        
seaborn                  0.9.dev0     
Send2Trash               1.5.0        
setuptools               39.2.0       
simplegeneric            0.8.1        
simplejson               3.16.0       
sip                      4.19.8       
six                      1.11.0       
snakeviz                 0.4.2        
snowballstemmer          1.2.1        
sortedcontainers         2.0.4        
sounddevice              0.3.11       
Sphinx                   1.7.5        
sphinx-rtd-theme         0.4.0        
sphinxcontrib-websupport 1.1.0        
spyder                   3.3.0.dev0   
spyder-kernels           0.2.3        
SQLAlchemy               1.2.9        
sqlite-bro               0.8.11       
sqlparse                 0.2.4        
statsmodels              0.9.0        
streamz                  0.3.0        
supersmoother            0.4          
sympy                    1.1.1        
tables                   3.4.4        
tblib                    1.3.2        
terminado                0.8.1        
testpath                 0.3.1        
Theano                   1.0.2        
thrift                   0.11.0       
toolz                    0.9.0        
torch                    0.4.0        
torchvision              0.2.1        
tornado                  5.0.2        
tqdm                     4.23.4       
traitlets                4.3.2        
traittypes               0.2.1        
twine                    1.11.0       
twitter                  1.17.1       
typing                   3.6.4        
uncertainties            3.0.2        
urllib3                  1.23         
vega                     1.3.0        
vega3                    0.13.0       
ViTables                 3.0.0        
wcwidth                  0.1.7        
webencodings             0.5.1        
Werkzeug                 0.14.1       
wheel                    0.31.1       
widgetsnbextension       3.2.1        
winpython                1.10.20180624
wordcloud                1.4.1        
wrapt                    1.10.11      
xarray                   0.10.7       
xlrd                     1.1.0        
XlsxWriter               1.0.5        
xlwings                  0.11.5       
zarr                     2.2.0        
zict                     0.1.3        

@stonebig
Copy link
Contributor Author

stonebig commented Jul 1, 2018

on a full rebuild of same stack, but with jupyterlab-0.32.1, the new errors don't appear (except this jupyterla_holoviews already registered)

it smells jupyterlab-0.33.0rc0 will require a few weeks of stabilization.

@stonebig stonebig changed the title compatibility with Jupyterlab-0.33.0rc ? compatibility with Jupyterlab-0.33.0rc0 ? Jul 1, 2018
@jasongrout
Copy link

0.33.0 is a major release with lots of things changing. The holoviews plugin for JLab 0.32 may need to be updated to work with 0.33.0.

@philippjfr
Copy link
Member

Thanks @jasongrout, is there a good place to see an overview of the coming changes?

@jasongrout
Copy link

Our changelog issue has a few notes that we'll be filling out over the next few days, especially as we update some of the extensions we maintain: jupyterlab/jupyterlab#4622

The release milestone has the merged PRs: https://github.com/jupyterlab/jupyterlab/milestone/12?closed=1

And we'll be coordinating the release in this issue: jupyterlab/jupyterlab#4827

@philippjfr
Copy link
Member

philippjfr commented Jul 15, 2018

Thanks again @jasongrout. It seems the issue is caused by the new javascript mime renderer, what's the easiest way of ensuring that a custom mime type (in this case 'application/vnd.holoviews_exec.v0+json') takes precedence? Are precedences less than 0 valid?

@stonebig
Copy link
Contributor Author

any guess of the time it will take to get holoviews compatible ?

@jasongrout
Copy link

@jlstevens
Copy link
Contributor

any guess of the time it will take to get holoviews compatible ?

I believe Philipp had a working prototype so I doubt it will take long to release an updated extension once he is back from holiday.

@stonebig
Copy link
Contributor Author

ok, if there is a dev branch already somewhere on github that solves this, let me know.

@ea42gh
Copy link
Contributor

ea42gh commented Jul 28, 2018

@stonebig did you ever resolve 'jupyterlab_holoview is already registered'?
When I saw this in the past, the only way I found to get rid of it was to delete all jupyter files
including local configs, then reinstall from scratch...

@stonebig
Copy link
Contributor Author

@ea42gh it's apparently not the problem. does Holoviews works for you on Jupyterlab-0.33.2 ?

@ea42gh
Copy link
Contributor

ea42gh commented Jul 28, 2018

import holoviews as hv
import numpy as np
hv.extension('bokeh')
hv.Curve(np.random.normal(size=10))

pops up a window with the plot with jupyter lab version 0.33.0
Using matplotlib, I only get the string representation :Curve [x] (y)

Don't think the multiple registration has anything to do with it,
but found it disconcerting when it popped up, so I got rid of it...

@stonebig
Copy link
Contributor Author

stonebig commented Jul 28, 2018

interesting. I'll try with bokeh backbone instead of matplotlib, as a workaround. ... no: same error.

@stonebig
Copy link
Contributor Author

status of the day Python-3.7 / Jupyterlab-0.33.4:
image

@stonebig
Copy link
Contributor Author

stonebig commented Jul 31, 2018

having now the jupyterlab_bokeh compatible version .. didn't change anything.

@Bonnevie
Copy link

I am having similar issues. The strangely embedded image even persists when I change files using the lab's file manager and if I click the file that generated the image it spawns an additional copy even if I do not run any cells.

@philippjfr
Copy link
Member

jupyterlab_pyviz releases 0.6.0 and 0.6.1 now have compatibility with jupyterlab 0.33 and 0.34.

@stonebig
Copy link
Contributor Author

oups! I forgot to close the issue. I confirm everything is ok now.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2024
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

6 participants