# Python SDK

> This guide provides step-by-step instructions for installing and setting up the Pixyz Python SDK, including prerequisites, pip installation, and running your first script.

## Prerequisites

* Compatible [system](./system)
* Python 3.1 minimum. 3.10 or newer recommended
* A valid Pixyz SDK license on your Pixyz [license portal](https://www.pixyz-software.com/my-account/license-management)

## Setup

### Setup using pip (recommended)

1. Run `pip install pxz --extra-index-url https://unity3ddist.jfrog.io/artifactory/api/pypi/pixyz-pypi-prod-local/simple`
2. [Setup your license](./license/licensingintro)
3. [Run your first script](#run-your-first-script)

#### SDK without UI frontend

In this case, you will only have access to the Python API/SDK and not the UI frontend.

1. Run `pip install pxz --no-deps --extra-index-url https://unity3ddist.jfrog.io/artifactory/api/pypi/pixyz-pypi-prod-local/simple`
2. [Setup your license](./license/licensingintro)
3. [Run your first script](#run-your-first-script)

> **Note:**
>
> The package is hosted at the following index location: `https://unity3ddist.jfrog.io/artifactory/api/pypi/pixyz-pypi-prod-local/simple`
>
> [More information](https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-from-other-indexes) about installing from custom indexes.

> **Important:**
>
> **Windows only**: be aware of warnings related to search paths such as `WARNING: The scripts PiXYZFinishInstall.exe, PiXYZGenerateActivationCode.exe and PiXYZInstallLicense.exe are installed in [...] which is not on PATH`.
>
> If this happens, simply add missing paths to PYTHONPATH or add the base path prefix to the script.

### Setup without pip

#### PyCharm

1. Download SDK from [archive](https://unity3ddist.jfrog.io/ui/repos/tree/General/pixyz-generic-prod-local)
2. Open project
3. Locate your Pixyz SDK binaries folder on your machine or local dev environement
4. Add Pixyz binaries folder to your interpreter path ([check PyCharm documentation](https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-reloading-interpreter-paths.html))

![pycharm](/api/media?file=/asset-transformer-sdk/media/images/101/pycharm-sett.png)

5. [Setup your license server](./license/licensingintro)
6. [Run your first script](#run-your-first-script)

#### Visual Studio Code

1. Download SDK from [archive](https://unity3ddist.jfrog.io/ui/repos/tree/General/pixyz-generic-prod-local)
2. Open project
3. Create a [Python environment](https://code.visualstudio.com/docs/python/environments)
4. Set `PYTHONPATH` to the Pixyz binaries folder path (by adding an .env file to the project for example)
5. [Setup your license](./license/licensingintro)
6. [Run your first script](#run-your-first-script)

## Run your first script

```python title="Python"
import pxz
from pxz import core

# init Pixyz
pxz.initialize()

# print Pixyz version
print(core.getVersion())

# set log level to INFO so you can see the logs in the console
core.configureInterfaceLogger(True, True, True)
core.addConsoleVerbose(core.Verbose.INFO)

# if no license is found, try to configure a license server
if not core.checkLicense():
    core.configureLicenseServer("company-server-hostname", 27000, True)

# use io.importScene to import a file and enjoy :)
```
