<!-- Source: https://docs.squirro.com/en/latest/technical/ai-studio/how-to/jupyter.html -->
# How to Interact with Squirro Using Jupyter Notebook

Profiles: Data Scientist, Project Creator

This guide shows you how to interact with Squirro using Jupyter Notebook.

Specifically, it guides you through the process of installing the necessary software components and provides a [sample Notebook](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/2592276962/squirro-notebook-example.ipynb) to get you started.

> **Note**
>
> It is assumed that you have already installed a recent version of Python. If you have not, refer to the [official Python documentation](https://wiki.python.org/moin/BeginnersGuide).

## Prepare a Virtual Environment

With Python installed, open a console and create a virtual environment:

```bash
python -m venv ~/squirro-venv
```

This virtual environment will be used to install any Python packages that you may need during your experiments with Squirro.

Reminder: Remember that you need to have this virtual environment activated to install new packages in it or use existing ones. You can always activate it by issuing the following command:

```python
source ~/squirro-venv/bin/activate
```

For more information regarding virtual environments in Python, refer to the [official Python guide](https://docs.python.org/3/library/venv.html), though the information on this page will likely be sufficient.

The next step is to install two packages in your virtual environment:

- Jupyter Notebook
- SquirroClient

```bash
pip install SquirroClient notebook
```

The `SquirroClient` is the official Squirro SDK for Python. You can use it to programmatically interact with your Squirro instance.

Reference: For more information, see [SquirroClient (Python SDK)](../../api/squirro_client/index.md#squirro-client).

The Jupyter Notebook is an application that is widely used when conducting an [Exploratory Data Analysis (EDA)](https://en.wikipedia.org/wiki/Exploratory_data_analysis).

If you prefer an alternative software package (such as JupyterLab) feel free to use it as well. The only restriction for it is that you need to be able to run Python code.

## Launch the Jupyter Notebook server

Now, you are ready to launch the Jupyter Notebook server:

```python
jupyter notebook
```

You can either create a new notebook or use the one provided [here](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/2592276962/squirro-notebook-example.ipynb) to get you started.

## Obtain a Personal Access Token

The last step that you need to do is to obtain a personal access token for interacting with Squirro and use it for authenticating the `SquirroClient`. To get one, navigate to your Squirro instance. Then, in the top-right corner, click on your initials and select My Account.

[![image1](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/2592276962/2592276977.png)](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/2592276962/2592276977.png)

In the left menu, click API Access, then click Generate within the _User Token_ field.

[![image2](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/2592276962/2592276983.png)](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/2592276962/2592276983.png)

Copy your token and set it as a value to the `token` variable of the
[provided Jupyter notebook](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/2592276962/squirro-notebook-example.ipynb).

## Get to Work With Your Data

The provided Jupyter notebook shows you how to connect to a Squirro instance, and includes a basic demo of how to use the [SquirroClient (Python SDK)](../../api/squirro_client/index.md#squirro-client) along with some toy ground truth data to get you started with an EDA.

Firstly, you need to create a _Ground Truth_ using AI Studio.

Reference: See [Ground Truths](../ground-truth.md#ai-ground-truths) for more information.

Then, by using the method `get_groundtruth_labels` of the `SquirroClient` and providing the id of the ground truth (_groundtruth_id_) and the id of the project that this ground truth belongs to (_project_id_), you can fetch all its labeled examples.

[![image3](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/2592276962/2592276969.png)](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/2592276962/2592276969.png)

The complete demo can be found in the [provided Jupyter notebook](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/2592276962/squirro-notebook-example.ipynb).
