Setup#

This first step to the tutorial will make sure your system is set up to do all the remaining sections, with all software installed and all data downloaded as needed. The index provided some links you might want to examine before you start.

Getting set up#

Please consult holoviz.org for the full instructions on installing the software used in these tutorials. Here is the condensed version of those instructions, assuming you have already downloaded and installed Anaconda or Miniconda and have opened a command prompt in a Conda environment:

conda create -n project "anaconda-project>=0.11"
conda activate project
anaconda-project download pyviz/holoviz_tutorial
cd holoviz_tutorial # You may need to delete this directory if you've run the command above before
anaconda-project run jupyter notebook

If you prefer JupyterLab to the default (classic) notebook interface, you can replace “notebook” with “lab”.

Once your chosen environment is running, navigate to tutorial/00_Setup.ipynb (i.e. this notebook) and run the following cell to test the key imports needed for this tutorial. If it completes without errors your environment should be ready to go:

import datashader as ds, bokeh, holoviews as hv, panel as pn  # noqa
from packaging.version import Version

min_versions = dict(ds='0.15.1', bokeh='3.2.0', hv='1.16.2', pn='1.2.0')

for lib, ver in min_versions.items():
    v = globals()[lib].__version__
    if Version(v) < Version(ver):
        print("Error: expected {}={}, got {}".format(lib,ver,v))

And you should see the HoloViews, Bokeh, and Matplotlib logos after running the following cell:

hv.extension('bokeh', 'matplotlib')

Downloading sample data#

Lastly, let’s make sure the datasets needed are available. First, check that the large earthquake dataset was downloaded correctly during the anaconda-project run command:

import pathlib
from pyct import cmd

if not pathlib.Path('../data/earthquakes-projected.parq').is_file():
    cmd.fetch_data(name='holoviz', path='..') # Alternative way to fetch the data

Make sure that you have the SNAPPY dependency required to read these data:

try:
    import pandas as pd
    columns = ['depth', 'id', 'latitude', 'longitude', 'mag', 'place', 'time', 'type']
    path = pathlib.Path('../data/earthquakes-projected.parq')
    data = pd.read_parquet(path, columns=columns, engine='fastparquet')
    data.head()
except RuntimeError as e:
    print('The data cannot be read: %s' % e)

If you don’t see any error messages above, you should be good to go! Now that you are set up, you can continue with the rest of the tutorial sections.

This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.

Right click to download this notebook from GitHub.