> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Installing Python libraries

export const m_runner = "Maia runner";

export const maia = "Maia";

export const RunnerMetadata = ({runnerType, platforms = []}) => {
  return <div style={{
    background: 'var(--colors-background-light, #f9fafb)',
    border: '1px solid var(--colors-border-default, #e5e7eb)',
    borderRadius: '12px',
    padding: '20px 28px',
    marginBottom: '28px'
  }}>
      <table style={{
    width: '100%',
    borderCollapse: 'collapse'
  }}>
        <tbody>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle',
    width: '180px'
  }}>Runner type</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{runnerType}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Runner platform</td>
            <td style={{
    verticalAlign: 'middle'
  }}>
              <div style={{
    display: 'flex',
    flexWrap: 'wrap',
    gap: '8px'
  }}>
                {platforms.map((platform, i) => <span key={i} style={{
    background: '#dcfce7',
    color: '#15803d',
    border: '1px solid #bbf7d0',
    borderRadius: '9999px',
    padding: '3px 12px',
    fontSize: '0.85rem',
    fontWeight: '500',
    whiteSpace: 'nowrap'
  }}>
                    {platform} ✅
                  </span>)}
              </div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>;
};

<RunnerMetadata runnerType={`${maia} Hybrid`} platforms={["AWS", "Azure", "Google Cloud"]} />

The [Python Script](/docs/components/python-script) component lets you import modules from any Python library. To do this, you need to upload the packages to an Amazon S3 bucket, Azure Blob Storage container, or GCS bucket accessible to the {m_runner}, as described below.

***

## Install the Python package

When installing Python libraries for [Hybrid SaaS {m_runner}s](/docs/guides/runner-overview#hybrid-saas/), make sure the libraries are compiled for the correct platform. Hybrid SaaS {m_runner}s run on Linux (Ubuntu).

If you install packages on a different operating system (for example, macOS or Windows), `pip` may fetch incompatible binaries that can't run inside the {m_runner}. This often causes runtime errors.

<Note>
  Python scripts in {maia} should be written to be version-agnostic where possible. The Python runtime bundled with the {m_runner} is updated periodically, and there is no guarantee a specific version will remain in place indefinitely. Be aware of this when installing libraries, and try to ensure the libraries you install are compatible with a range of Python versions where possible.

  At time of writing (April 2026), the {m_runner} uses Python 3.12.
</Note>

1. Create a directory on your local machine to store the downloaded libraries:

   ```
   mkdir python_libs
   ```

2. Download the required libraries using `pip` with the `--platform` and `--only-binary flags`:

   ```
   python3 -m pip install --target=./python_libs --platform=manylinux2014_x86_64 --only-binary=:all: scipy pandas numpy
   ```

   **Command breakdown:**

   * `--target=./python_libs`: Specifies the installation directory.
   * `--platform=manylinux2014_x86_64`: This flag is critical. It directs `pip` to download the package for the specified Linux platform and architecture, matching the {m_runner}'s environment.
   * `--only-binary=:all:`: Ensures that `pip` downloads pre-compiled binary wheels instead of attempting to build from source.

3. After the command completes, the `./python_libs` folder will contain the specified libraries and all their dependencies, compiled for the correct platform.

4. Copy the entire folder into an S3 bucket (for AWS-hosted {m_runner}s), Azure Blob Storage container (for Azure-hosted {m_runner}s), or GCS bucket (for GKE-hosted {m_runner}s) that is accessible to the {m_runner}.

   <Note>
     At this point, you can delete the package from your local drive, if you wish.
   </Note>

5. The IAM role tied to the {m_runner} (AWS) or the managed identity (Azure) must have certain user permissions to access this storage location. Read [Storing external files](/docs/guides/optional-runner-parameters#storing-external-files) for details of these permissions.

6. Set a {m_runner} parameter `EXTENSION_LIBRARY_LOCATION`, with the value being the absolute path of the cloud storage folder containing the package and its dependencies:

   * AWS S3: `s3://my-additional-libraries`
   * Azure Blob Storage: `https://mystorageaccount.blob.core.windows.net/my-files`
   * GCS: `gs://my-bucket/my-python-libs`

   Read [Optional {m_runner} parameters](/docs/guides/optional-runner-parameters) for details.

Upon completion, the Python Script component can reference and access your installed libraries via your script.
