# Installation (Python SDK)

This guide will help you install the Market Data Python SDK and configure it for your needs.

## Prerequisites

- Python >= 3.10

## Basic Installation

Install the Market Data Python SDK from PyPI:

### pip

```bash
pip install marketdata-sdk-py
```

### uv

```bash
uv pip install marketdata-sdk-py
```

## Installation with DataFrame Support

The SDK supports multiple DataFrame libraries for `OutputFormat.DATAFRAME`. To use DataFrame output format, you need to install at least one DataFrame library.

### Install with pandas (recommended)

### pip

```bash
pip install "marketdata-sdk-py[pandas]"
```

### uv

```bash
uv pip install "marketdata-sdk-py[pandas]"
```

### Install with polars

### pip

```bash
pip install "marketdata-sdk-py[polars]"
```

### uv

```bash
uv pip install "marketdata-sdk-py[polars]"
```

### Install with both pandas and polars

### pip

```bash
pip install "marketdata-sdk-py[pandas,polars]"
```

### uv

```bash
uv pip install "marketdata-sdk-py[pandas,polars]"
```

## Optional Dependencies

The SDK supports multiple DataFrame libraries for `OutputFormat.DATAFRAME`. You must install at least one of the following:

- **pandas** (recommended): `pandas>=2.3.3`
- **polars**: `polars-lts-cpu>=1.33.1`

### DataFrame Handler Priority

When using `OutputFormat.DATAFRAME`, the SDK automatically selects an available DataFrame library in the following order:

1. **pandas** (if installed)
2. **polars** (if pandas is not installed)

If neither pandas nor polars is installed, a `ValueError` will be raised when attempting to use `OutputFormat.DATAFRAME`:

```python
ValueError: No dataframe output handler found
```

> [!NOTE]
> You can use other output formats (`OutputFormat.INTERNAL`, `OutputFormat.JSON`, `OutputFormat.CSV`) without installing pandas or polars.

## Local Development Installation

For local development, install from the project directory:

```bash
# Clone the repository
git clone https://github.com/MarketDataApp/sdk-py.git
cd sdk-py

# Install the package
pip install .

# Or install with optional dependencies
pip install ".[pandas]"
```

## Core Dependencies

The SDK includes the following core dependencies (installed automatically):

- `httpx>=0.28.1`: HTTP client library for making API requests
- `pydantic>=2.12.5`: Data validation and settings management
- `pydantic-settings>=2.12.0`: Configuration management from environment variables
- `tenacity>=9.1.2`: Retry logic library for handling transient errors

## Next Steps

After installation, you'll need to:

1. Set up your [authentication token](https://www.marketdata.app/docs/sdk/py/authentication)
2. Learn about the [client](https://www.marketdata.app/docs/sdk/py/client) and how to make your first API requests
3. Configure [settings](https://www.marketdata.app/docs/sdk/py/settings) to customize output format, date format, and other universal parameters
