holoviz-topics / examples

Visualization-focused examples of using HoloViz for specific topics
https://examples.holoviz.org
Creative Commons Attribution 4.0 International
80 stars 24 forks source link

Explain better how to get data for datashader_dashboard #141

Open dhruvbalwada opened 3 years ago

dhruvbalwada commented 3 years ago

The user guide (https://examples.pyviz.org/user_guide) has a note that reads: \ NOTE: If the notebook depends on data files, you will need to download them explicitly if you don’t use anaconda-project, by extracting the URLs defined in anaconda-project.yml and saving the file(s) to this directory.

I don't see any URLs in the yml file. If there is a single URL, would it not just be easier to place it in the markdown text in the example notebook itself?

Here is the file I obtained from the datashader_dashboard example:

name: datashader_dashboard
description: Interactive dashboard for making Datashader plots from any dataset that
  has latitude and longitude
channels:
- conda-forge
- nodefaults
packages: &id001
- python=3.6
- notebook=5.7.8
- ipykernel=5.1.0
- nomkl
- anaconda-project=0.8.3
- colorcet=2.0.1
- datashader=0.7.0
- fastparquet=0.3.0
- holoviews=1.12.3
- hvplot=0.4.0
- intake=0.5.3
- intake-parquet=0.2.2
- panel=0.6.0
- param=1.9.1
- python-snappy=0.5.4
dependencies: *id001
commands:
  dashboard:
    unix: panel serve dashboard.ipynb
    supports_http_options: true
  census:
    unix: 'anaconda-project prepare --directory ../census

      DS_DATASET=census panel serve dashboard.ipynb

      '
    supports_http_options: true
  nyc_taxi:
    unix: 'anaconda-project prepare --directory ../nyc_taxi

      DS_DATASET=nyc_taxi panel serve dashboard.ipynb

      '
    supports_http_options: true
  opensky:
    unix: 'anaconda-project prepare --directory ../opensky

      DS_DATASET=opensky panel serve dashboard.ipynb

      '
    supports_http_options: true
  osm:
    unix: DS_DATASET=osm-1b panel serve dashboard.ipynb
    supports_http_options: true
  notebook:
    notebook: dashboard.ipynb
variables:
  DS_DATASET:
    description: Choose a dataset from nyc_taxi, osm-1b, census, opensky, nyc_taxi_small
    default: nyc_taxi_small
env_specs:
  default: {}
jbednar commented 3 years ago

The datashader_dashboard is a special case; it can be run with any data file that's defined in the include Intake catalog.yml file. The ones currently listed there are files downloaded in other examples, so you'll need to run one of the other examples to get them (nyc_taxi, osm, census, opensky). The example was originally installed in a group with other examples, so the other files would already be available, but now that it's downloadable individually we should explain how that works better! I'll rename this issue to reflect that.

dhruvbalwada commented 3 years ago

I managed to get the data for nyc-taxi example, and now there is a file called nyc_taxi_wide.parq that is sitting in path ../nyc_taxi/data/.

I would be happy to update this example saying how to get the data, but I am not sure if it works at the moment.

Trying to run the first code cell in the notebook spits out this error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-46a06732e6db> in <module>
----> 1 import os, colorcet, param as pm, holoviews as hv, panel as pn, datashader as ds
      2 import intake
      3 from holoviews.element import tiles as hvts
      4 from holoviews.operation.datashader import rasterize, shade, spread
      5 from collections import OrderedDict as odict

~/Downloads/datashader_dashboard/envs/default/lib/python3.6/site-packages/panel/__init__.py in <module>
      3 import param as _param
      4 
----> 5 from . import layout # noqa
      6 from . import links # noqa
      7 from . import pane # noqa

~/Downloads/datashader_dashboard/envs/default/lib/python3.6/site-packages/panel/layout.py in <module>
     16 
     17 from .util import param_name, param_reprs
---> 18 from .viewable import Reactive
     19 
     20 

~/Downloads/datashader_dashboard/envs/default/lib/python3.6/site-packages/panel/viewable.py in <module>
     21 
     22 from .callbacks import PeriodicCallback
---> 23 from .config import config, panel_extension
     24 from .io.embed import embed_state
     25 from .io.model import add_to_doc

~/Downloads/datashader_dashboard/envs/default/lib/python3.6/site-packages/panel/config.py in <module>
     17                          extension as _pyviz_extension)
     18 
---> 19 from .io.notebook import load_notebook
     20 from .io.state import state
     21 

~/Downloads/datashader_dashboard/envs/default/lib/python3.6/site-packages/panel/io/__init__.py in <module>
      9 from .resources import Resources # noqa
     10 from .server import get_server # noqa
---> 11 from .notebook import block_comm, load_notebook, push # noqa

~/Downloads/datashader_dashboard/envs/default/lib/python3.6/site-packages/panel/io/notebook.py in <module>
     23 from bokeh.resources import CDN, INLINE
     24 from bokeh.util.compiler import bundle_all_models
---> 25 from bokeh.util.string import encode_utf8
     26 from jinja2 import Environment, Markup, FileSystemLoader
     27 from pyviz_comms import (

ImportError: cannot import name 'encode_utf8'

I believe this is the same thing as what is in #140.

I tried to update panel following this https://github.com/holoviz/holoviews/issues/4346 , but that didn't help. Some other library is mismatched, but I am not sure which one.

ppwadhwa commented 3 years ago

Sounds like we need to investigate the error you're seeing here, and we need a better explanation included in the notebook that says that we need to run one of the other example projects before we run this notebook.