Before you can get started with Panel you are going to need a couple of things:
Setting up Python#
The recommended way to install Panel on all operating systems is using the conda_ command provided by Anaconda or Miniconda. If you are not familiar with command line interfaces we recommend you use the Anaconda installer and use Anaconda Navigator.
Alternatively you can also set up your own Python installation and manage your environment using a different environment management tool such as:
Once you have set up Python and chosen an environment management tool install Panel using either
conda install -c pyviz panel
pip install panel
Getting the examples#
Most guides and examples that are rendered as part of the documentation are in fact written as Jupyter notebooks. We recommend that if you want to follow along with the examples you copy the examples to a local path, e.g. to copy to the current path use:
panel examples --path ./
Once the examples are copied switch to the directory you copied them to and launch a Jupyter notebook, e.g. with:
Now you can navigate through the getting started and user guides and the various (reference) gallery examples.
Developing in different editors#
Editor + Server#
You can edit your Panel code as a
.py file in any text editor, marking the objects you want to render as
.servable(), then launch a server with:
panel serve my_script.py --show --autoreload``
to open a browser tab showing your app or dashboard and backed by a live Python process. The
--autoreload flag ensures that the app reloads whenever you make a change to the Python source.
JupyterLab and Classic notebook#
In the classic Jupyter notebook environment and JupyterLab, first make sure to load the
pn.extension(). Panel objects will then render themselves if they are the last item in a notebook cell. For versions of
jupyterlab>=3.0 the necessary extension is automatically bundled in the
pyviz_comms package, which must be >=2.0.
However note that for version of
jupyterlab<3.0 you must also manually install the JupyterLab extension with::
jupyter labextension install @pyviz/jupyterlab_pyviz
In the Google Colaboratory notebook, first make sure to load the
pn.extension(). Panel objects will then render themselves if they are the last item in a notebook cell. Please note that in Colab rendering for each notebook cell is isolated, which means that every cell must reload the Panel extension code separately. This will result in somewhat slower and larger notebook than with other notebook technologies.
Visual Studio Code (VSCode) versions 2020.4.74986 and later support ipywidgets, and Panel objects can be used as ipywidgets since Panel 0.10 thanks to
jupyter_bokeh, which means that you can now use Panel components interactively in VSCode. Ensure you install
pip install jupyter_bokeh or
conda install -c bokeh jupyter_bokeh and then enable the extension with
nteract and other ipywidgets notebooks#
In other notebook environments that support rendering ipywidgets interactively, such as nteract, you can use the same underlying ipywidgets support as for vscode: Install
jupyter_bokeh and then use
If you get stuck for any reason come join our helpful community Discourse forum and someone will come to your aid.