Skip to content

Dashboard plot sizing issue with bokeh=3 #7173

Closed

Description

@bryevdv

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.

Activity

  1. jrbourbeau commented on Oct 21, 2022

    @jrbourbeau
    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

  2. bryevdv commented on Oct 21, 2022

    @bryevdv
    ContributorAuthor

    @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.

  3. jrbourbeau commented on Oct 21, 2022

    @jrbourbeau
    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

  4. bryevdv commented on Oct 21, 2022

    @bryevdv
    ContributorAuthor

    @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)

  5. bryevdv commented on Oct 21, 2022

    @bryevdv
    ContributorAuthor

    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.

  6. bryevdv commented on Oct 26, 2022

    @bryevdv
    ContributorAuthor

    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()
    
  7. gabicca commented on Nov 14, 2022

    @gabicca

    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

  8. changed the title [-]Bokeh 3.0 changes / version cap[/-] [+]Dashboard plot sizing issue with `bokeh=3`[/+] on Nov 17, 2022
  9. jrbourbeau commented on Nov 17, 2022

    @jrbourbeau
    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

  10. jrbourbeau commented on Nov 17, 2022

    @jrbourbeau
    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

  11. jrbourbeau commented on Nov 17, 2022

    @jrbourbeau
    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?

  12. mattpap commented on Nov 17, 2022

    @mattpap
    Contributor

    @jrbourbeau, how do I reproduce this?

  13. gjoseph92 commented on Nov 17, 2022

    @gjoseph92
    Collaborator

    @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.

  14. gabicca commented on Nov 22, 2022

    @gabicca

    @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?

  15. jrbourbeau commented on Nov 22, 2022

    @jrbourbeau
    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?

  16. gabicca commented on Nov 23, 2022

    @gabicca

    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.

  17. gabicca commented on Nov 30, 2022

    @gabicca

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

  18. self-assigned this
    on Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions