Creating a Spotfire Package for Python Packages from a Windows Computer
An installation of Spotfire Analyst includes a Python interpreter and a set of packages to enable using Python in Spotfire.
About this task
-m pip install spotfire
Spotfire Analyst relies on pip, the Python command-line application for Python package installation. Spotfire Analyst uses a requirements.txt file to specify the packages to include in your SPK. By default, the file requirements.txt searches the PyPI package site for the specified package and version.
- To include a package from
a different repository or in a local file path, in the
requirements.txt file, use the option
-i
or--index-url
, followed by the location URL.#example # mylib -i http://my.domain.org/lib/1.0.0/mylib/
- To include a
.whl package, in the
requirements.txt file, provide the relative path
to the package from the current working directory.
#simple-example # ./my_path/my_package.whl packaging==1.0.0
If you are building an SPK intended for the Spotfire Service for Python, then avoid specifying packages that are included with the service installation. Installing a different version of one of these packages can cause unexpected errors. If a package you are installing depends on or requires one of the included packages, then it is filtered out when the SPK is built.
WARNING: Target directory <<temporary location>>\<<package>> already exists. Specify --upgrade to force replacement.
The text of the warning can vary depending on the contents of the
third-party wheel packages and operating system. This warning is from the PIP
system; for our purposes, it is of no importance and can be disregarded.
For more information about creating a requirements.txt file for your package list, see its documentation at the following location.
- https://pip.readthedocs.io/en/stable/user_guide/#requirements-files
- https://pip.readthedocs.io/en/stable/reference/pip_install/#requirements-file-format
This task creates an SPK for the Spotfire Service for Python, running on a node available to Spotfire Server. If you need to build a package to distribute to Spotfire Analyst users, see Python Data Functions in Spotfire®.
Perform this task from a command prompt on the Windows computer where Spotfire Analyst is installed.
Before you begin
- You must have the appropriate Spotfire license for authoring data functions.
- You must have created the
file
requirements.txt containing the list of packages
to include in your SPK.
The following example specifies these packages and specified versions from PyPI.
####### example-requirements.txt ###### # scipy == 1.11.2 matplotlib == 3.7.2 statsmodels == 0.14.0
Procedure
Results
For an overview of the entire process, see Package Management for the Spotfire Service for Python.