Spotfire Service for Python Installation and Administration

Troubleshooting the Service

If you have problems with the service, review these tips.

Problems with the startup script
Check your script line endings.
Important: Remember that for any script you write, the line endings must be appropriate for the operating system where the service runs. Many text editors can perform end-of-line (EOL) conversion.
Packages installed on a node manager running a different operating system than the engine
This unlikely case can happen if, for example, you are running the debian:12-slim Docker image for your Spotfire Service for Python, but your node manager computer is running Red Hat Enterprise Linux (RHEL) 9. Because of symbol version issues, packages must be installed in an equivalent OS to the execution environment. If this is not possible, try one of the following workarounds:
  • Install the packages on a computer running the same operating system as your execution environment, and then copy those packages to the node manager running the other operating system. Provide the path in custom.properties file for the configuration packagepath.
  • Create a customized image with debian:12-slim, and then install the required packages in the image. Provide the image name in the custom.properties file in the configuration setting docker.image.name.
Empty String columns in exported SBDF causes an error
When you export an SBDF from Python (for example, as an output for a data function), and your output contains an empty column, you can encounter the following error:
spotfire.sbdf.SBDFError: cannot determine type for column 'EmptyString'; all values are missing

This error occurs because the Spotfire data function environment cannot determine the proper Spotfire type to export the data as if all values in the column are missing (in other words, Python's None, NumPy's nan, or Panda's NA or NaT values).

To resolve this issue, edit your data function to use the helper function set_spotfire_types.

Example

In the following example, the variable name EmptyString refers to a string column that contains no values. (For your export, use the actual empty column name.) In this example, the function spotfire.set_spotfire_types sets the column specifically to the Spotfire data type String.
import pandas as pd
import spotfire

outp = pd.DataFrame(inp)
spotfire.set_spotfire_types(outp, {'EmptyString': 'String'})
Memory usage
The maximum memory needed to run a Python script can exceed the javaOptions setting, depending on the size of the data, the Python packages used, and how the Python script is written.
Note: The javaOptions setting controls Java memory only, and does not control memory allocated in the Python runtime. (Memory allocated by Java is typically very small, which makes it possible to set a very low value for the initial heap size, such as Xms64M.)
If you encounter memory issues:
  • Try running your script using a stand-alone Python engine to gauge its memory usage. You should see no difference between the memory needed for running your script in a stand-alone Python engine and running under the Spotfire Service for Python.
  • If you are running a containerized service, you can set a limit on the memory usage for the engine process. See the example under ram.limit in Containerized configuration.
  • Use utility functions such as memAvailable to find, report, and then reallocate available memory.