{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "

Tutorial 0. Setup

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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](index.ipynb) provided some links you might want to examine before you start." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Getting set up\n", "\n", "Please consult [holoviz.org](http://holoviz.org/installation.html) 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](https://www.anaconda.com/download) or [Miniconda](https://conda.io/miniconda.html) and have opened a command prompt in a Conda environment:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "conda install anaconda-project\n", "anaconda-project download pyviz/holoviz_tutorial\n", "cd holoviz_tutorial # You may need to delete this directory if you've run the command above before\n", "anaconda-project run jupyter notebook\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you prefer JupyterLab to the default (classic) notebook interface, you can replace \"notebook\" with \"lab\"." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import datashader as ds, bokeh, holoviews as hv # noqa\n", "from distutils.version import LooseVersion\n", "\n", "min_versions = dict(ds='0.13.0', bokeh='2.3.2', hv='1.14.4')\n", "\n", "for lib, ver in min_versions.items():\n", " v = globals()[lib].__version__\n", " if LooseVersion(v) < LooseVersion(ver):\n", " print(\"Error: expected {}={}, got {}\".format(lib,ver,v))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And you should see the HoloViews, Bokeh, and Matplotlib logos after running the following cell:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "hv.extension('bokeh', 'matplotlib')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Downloading sample data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "from pyct import cmd\n", "\n", "if not os.path.isfile('../data/earthquakes-projected.parq'):\n", " cmd.fetch_data(name='holoviz', path='..') # Alternative way to fetch the data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Make sure that you have the SNAPPY dependency required to read these data:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "try:\n", " import pandas as pd\n", " columns = ['depth', 'id', 'latitude', 'longitude', 'mag', 'place', 'time', 'type']\n", " data = pd.read_parquet('../data/earthquakes-projected.parq', columns=columns, engine='fastparquet')\n", " data.head()\n", "except RuntimeError as e:\n", " print('The data cannot be read: %s' % e)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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](01_Overview.ipynb). " ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 4 }