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

Dashboard plot sizing issue with bokeh=3 #7173

Closed
bryevdv opened this issue Oct 21, 2022 · 16 comments · Fixed by #7413
Closed

Dashboard plot sizing issue with bokeh=3 #7173

bryevdv opened this issue Oct 21, 2022 · 16 comments · Fixed by #7413
Assignees

Comments

@bryevdv
Copy link
Contributor

bryevdv commented Oct 21, 2022

ref: bokeh/bokeh#12503

It looks like there are some changes in the upcoming Bokeh major version bump that will need changes on the Dask side. cc @jrbourbeau what do you want to do here? If possible I think it would be advised to set a <3.0 version cap for now.

@jrbourbeau
Copy link
Member

Thanks for the heads up @bryevdv. We can easily set an upper bound if needed. When's the 3.0 release scheduled to come out? We might be able to patch things up here before then

@bryevdv
Copy link
Contributor Author

bryevdv commented Oct 21, 2022

@jrbourbeau Ostensibly next Monday but if you need a little more time to get another release out with a cap, we can wait a little longer.

@jrbourbeau
Copy link
Member

Rerunning CI in #5648 to see what failures look like. Is there an downstream CI build over in bokeh that has failures?

Our normal release schedule has a new release coming out next Friday, though we could also push out something earlier if needed. Setting the <3.0 upper bound with a new release is straightforward for conda-forge but (I think?) impossible for PyPI

@bryevdv
Copy link
Contributor Author

bryevdv commented Oct 21, 2022

@jrbourbeau there is one in https://github.com/bokeh/bokeh/actions/runs/3299130418/jobs/5442278509

this shows the Panel rename issue, but then there is also an issue with passing explicit id values which is no longer supported. We could potentially add deprecated WARs for those on our end, but there are also JS issues with CDS column length inconsistencies, so that will require some actual investigation and updates.

impossible for PyPI

If so, I'd recommend a programmatic check in dask with a meaningful message ("requires version > 2.1.1 and < 3.0" etc)

@bryevdv
Copy link
Contributor Author

bryevdv commented Oct 21, 2022

Our normal release schedule has a new release coming out next Friday, though we could also push out something earlier if needed.

I will just propose to our team to postpone one week. I think if you can also get a release out slightly earlier without too much hassle, that couldn't hurt, though.

@bryevdv
Copy link
Contributor Author

bryevdv commented Oct 26, 2022

BTW @jrbourbeau if you have a script or notebook that exercises the dashboard and would be useful for smoke / acceptance I'd love to check it in somewhere on our end so it's available for anyone to test with. I've been using this but something more substantial would be better think

from dask.distributed import Client, progress
import dask
import dask.dataframe as dd
from sklearn.linear_model import LinearRegression

client = Client(threads_per_worker=4,
                n_workers=2, memory_limit='2GB')

df = dask.datasets.timeseries()

def train(partition):
    est = LinearRegression()
    est.fit(partition[['x']].values, partition.y.values)
    return est

# client.dashboard_link

# df[['x', 'y']].resample('1h').mean().head()
# df.groupby('name').apply(train, meta=object).compute()

@gabicca
Copy link

gabicca commented Nov 14, 2022

Hi, when can we expect a release of distributed that accounts for the latest Bokeh version changes? We are getting the following error in our pipeline:

/usr/local/lib/python3.9/site-packages/distributed/client.py:4565: in get_task_stream
    return self.sync(
/usr/local/lib/python3.9/site-packages/distributed/utils.py:339: in sync
    return sync(
/usr/local/lib/python3.9/site-packages/distributed/utils.py:406: in sync
    raise exc.with_traceback(tb)
/usr/local/lib/python3.9/site-packages/distributed/utils.py:379: in f
    result = yield future
/usr/local/lib/python3.9/site-packages/tornado/gen.py:762: in run
    value = future.result()
/usr/local/lib/python3.9/site-packages/distributed/client.py:4589: in _get_task_stream
    from distributed.dashboard.components.scheduler import task_stream_figure
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    from __future__ import annotations
    
    import logging
    import math
    import operator
    import os
    from collections import OrderedDict, defaultdict
    from collections.abc import Iterable
    from datetime import datetime
    from numbers import Number
    from typing import Any, TypeVar
    
    import numpy as np
    from bokeh.core.properties import value, without_property_validation
    from bokeh.io import curdoc
    from bokeh.layouts import column, row
>   from bokeh.models import (
        AdaptiveTicker,
        Arrow,
        BasicTicker,
        BoxSelectTool,
        BoxZoomTool,
        CDSView,
        ColorBar,
        ColumnDataSource,
        CustomJSHover,
        DataRange1d,
        FactorRange,
        GroupFilter,
        HoverTool,
        HTMLTemplateFormatter,
        NumberFormatter,
        NumeralTickFormatter,
        OpenURL,
        Panel,
        PanTool,
        Range1d,
        ResetTool,
        Tabs,
        TapTool,
        Title,
        VeeHead,
        WheelZoomTool,
    )
E   ImportError: cannot import name 'Panel' from 'bokeh.models' (/usr/local/lib/python3.9/site-packages/bokeh/models/__init__.py)
/usr/local/lib/python3.9/site-packages/distributed/dashboard/components/scheduler.py:17: ImportError

This is with bokeh==3.0.1 and distributed==2022.10.2

@jrbourbeau jrbourbeau changed the title Bokeh 3.0 changes / version cap Dashboard plot sizing issue with bokeh=3 Nov 17, 2022
@jrbourbeau
Copy link
Member

@gabicca the latest distributed=2022.11.0 release has bokeh=3 compatibility updates. This will fix the ImporError you're seeing, though there are some known issues with dashboard plot sizing

@jrbourbeau
Copy link
Member

Here's an example of the dashboard plot sizing issue (from @mrocklin)

The vertical spacing seems to be gone

Screen Shot 2022-11-17 at 9 20 11 AM

@jrbourbeau
Copy link
Member

@bryevdv @mattpap I've still not been able to determine is this is an issue on the distributed side or the bokeh side. Do you have suggestions on how we might be able to proceed to determine where a fix is needed?

Also, @jacobtomlinson @pavithraes do either of you think there are CSS adjustments we could make in the meantime as a workaround?

@mattpap
Copy link
Contributor

mattpap commented Nov 17, 2022

@jrbourbeau, how do I reproduce this?

@gjoseph92
Copy link
Collaborator

gjoseph92 commented Nov 17, 2022

@mattpap there's a simple reproducer you could use in #7327. (Wrap the .compute() line in a while True loop if you want it to keep running.)

Oh, and navigate to http://localhost:8787/status to see the dashboard.

@gabicca
Copy link

gabicca commented Nov 22, 2022

@gabicca the latest distributed=2022.11.0 release has bokeh=3 compatibility updates. This will fix the ImporError you're seeing, though there are some known issues with dashboard plot sizing

Hi @jrbourbeau , So the original error is fixed, but now I'm getting a new import error:

/usr/local/lib/python3.9/site-packages/distributed/client.py:4591: in get_task_stream
    return self.sync(
/usr/local/lib/python3.9/site-packages/distributed/utils.py:339: in sync
    return sync(
/usr/local/lib/python3.9/site-packages/distributed/utils.py:406: in sync
    raise exc.with_traceback(tb)
/usr/local/lib/python3.9/site-packages/distributed/utils.py:379: in f
    result = yield future
/usr/local/lib/python3.9/site-packages/tornado/gen.py:762: in run
    value = future.result()
/usr/local/lib/python3.9/site-packages/distributed/client.py:4615: in _get_task_stream
    from distributed.dashboard.components.scheduler import task_stream_figure
/usr/local/lib/python3.9/site-packages/distributed/dashboard/components/scheduler.py:74: in <module>
    from distributed.dashboard.core import TabPanel
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    from __future__ import annotations
    
    import functools
    import warnings
    
    from bokeh.application import Application
    from bokeh.application.handlers.function import FunctionHandler
    from bokeh.server.server import BokehTornado
    from bokeh.server.util import create_hosts_allowlist
    from packaging.version import parse as parse_version
    
    import dask
    
    from distributed.dashboard.utils import BOKEH_VERSION
    from distributed.versions import MAX_BOKEH_VERSION, MIN_BOKEH_VERSION
    
    if BOKEH_VERSION < parse_version(MIN_BOKEH_VERSION) or BOKEH_VERSION > parse_version(
        MAX_BOKEH_VERSION
    ):
        warnings.warn(
            f"\nDask needs bokeh >= {MIN_BOKEH_VERSION}, < 3 for the dashboard."
            f"\nYou have bokeh=={BOKEH_VERSION}."
            "\nContinuing without the dashboard."
        )
>       raise ImportError(
            f"Dask needs bokeh >= {MIN_BOKEH_VERSION}, < 3, not bokeh=={BOKEH_VERSION}"
        )
E       ImportError: Dask needs bokeh >= 2.4.2, < 3, not bokeh==3.0.2
/usr/local/lib/python3.9/site-packages/distributed/dashboard/core.py:25: ImportError

I'm using distributed==2022.11.1 and bokeh==3.0.2 (as you can tell from the error). So this suggest that latest distributed is not compatible with bokeh 3. Is this a bug? A left over from previous releases? Or are they indeed not compatible?

@jrbourbeau
Copy link
Member

Or are they indeed not compatible?

Thanks @gabicca. This is intentional. There are known issues with rendering the dashboard with bokeh=3. As the error message says, for now we suggest users use bokeh<3. Out of curiosity, how are you installing distributed / bokeh?

@gabicca
Copy link

gabicca commented Nov 23, 2022

Or are they indeed not compatible?

Thanks @gabicca. This is intentional. There are known issues with rendering the dashboard with bokeh=3. As the error message says, for now we suggest users use bokeh<3. Out of curiosity, how are you installing distributed / bokeh?

I just went by what you said previously, that distributed 2022.11 supports bokeh 3; If it clearly breaks the code, why not just pin the bokeh version until the problems are fixed? Since you're raising an import error, not just a warning, I would not call it a "suggestion", it's more than that.

If you intend to just warn people, as is also done in this piece of code, then maybe raising an import error should be removed?

They are installed via pip from requirements.txt.

@gabicca
Copy link

gabicca commented Nov 30, 2022

I have created a new issue about the import error: #7362

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

Successfully merging a pull request may close this issue.

5 participants