Tutorial 0. 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:

In [ ]:
import datashader as ds, bokeh, holoviews as hv  # noqa
from packaging.version import Version

min_versions = dict(ds='0.14.0', bokeh='2.4.3', hv='1.15.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:

In [ ]:
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:

In [ ]:
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:

In [ ]:
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.