Using Python packages in TIBCO Spotfire

Last updated:
8:35am Jul 14, 2020

This article explains how to install and use Python packages in TIBCO Spotfire as well as how and admin can manage the python packages in use in the organization by distributing  selected Python packages using the Spotfire Server's deployment mechanism. This provides an opportunity for better governance of what python packages that are used in the organization.


Using Python and Python packages

Spotfire Analyst now comes with a bundled Python engine, and a user can add and use Python packages as desired. In order to import a Python package, so that the functions provided by the package can be used in a Spotfire data function,  one can use the pip python feature.

For example, using a command prompt at the location of the Python interpreter, which is in the modules folder of the Spotfire installation, typically: [SPOTFIRE INSTALL DIR]\Modules\Python Interpreter_[VERSION]\python\python.exe

At this location you can use the Python utility pip for example to install the nltk package.

>python.exe -m pip install nltk

This is a convenient way for individual users to add the Python packages they need, whenever they need it.

Governed Python package management

While it is convenient for individual users to add the packages they like to use as outlined in the earlier section, a data science manager or administrator may be concerned about which packages are used in their organization and may want to standardize and harmonize package usage among the users. Spotfire makes it easier to ensure that all Python users use the same packages and the same versions of these packages since administrators or superusers can control which packages and versions of packages that are automatically available to other users within their organization. This is acheived by embedding Python packages in Spotfire .spk files.  This means that the regular package deployment mechanism on the Spotfire server can be used to deploy Python packages to users; if needed, with group-level granularity. 

To achieve this, Spotfire comes with a Python package called which makes it possible to specify a set of Python packages to package into a .spk file. This is done using the pip utility and a requirements.txt configuration file, like this:

The file requirements.txt defines the Python packages to include in the myspk.spk file

On the command line, use: 

>>python.exe -m spotfire.spk packages --analyst myspk.spk requirements.txt

Note: you may have to set the PYTHONPATH. Refer to the detailed documentation if needed.

An administrator can then deploy the created .spk file on the relevant deployment areas of the Spotfire server, which means that the regular deployment mechanism of Spotfire will be used to push the packages to the users.


for an overview of the process to create a Spotfire .spk package containing the selected Python packages.

Back to the main wiki page for Python Data functions