# Building a Spotfire package (SPK) for Python packages from a Docker image on Windows

You can build a Spotfire package (SPK) using a Docker image on Windows, and then place the SPK on a Spotfire Server running on Linux.

## About this task

Perform this task from the command line on a Windows computer.

## Before you begin

Before you begin, complete the following tasks.

1. Locate and download Spotfire® Statistics Services for your operating system on the Spotfire Download site (license and account required). The product Spotfire® Statistics Services includes the Spotfire Service for Python.
2. In the Spotfire Statistics Services download bundle, find the component Spotfire Service for Python.
3. Extract the contents of the Spotfire Service for Python installation archive.

## Procedure

1. Create the file requirements.txt and place it in the same directory from where you are running the `spotfire-spk` script.
   The file requirements.txt contains a list of packages, with their version numbers, that are included in the SPK. For example:

       ####### example-requirements.txt ######
       #
       scipy == 1.11.2
       matplotlib == 3.9.2
       statsmodels == 0.14.0

2. Call the following commands:

       set PYTHON_VERSION=3.12.9
       docker build --build-arg PYTHON_VERSION -t python-build-base:%PYTHON_VERSION% python-build-base

3. Build the SPK.

       spotfire-spk <python-build-base-tag> [arguments to spotfire.spk module]
       spotfire-spk 3.12.9 packages python-packages.spk requirements.txt

   The file python-packages.spk containing the packages specified in requirements.txt is created.

## What to do next

Add the SPK to the Spotfire Server Deployment area, and then validate and save the area. See Adding Software Packages to a Deployment Area and Updating Services in the Spotfire® Server Installation and Administration guide for more information. If you have specified the --analyst flag in the arguments to the spotfire.spk module, then the next time the installed Spotfire client users connect to the Spotfire Server, they are prompted to update their installations with the new packages. Business authors and consumers connecting to Spotfire from a web browser can use analyses with data functions that use the functions in the packages.