How to Install Python Packages in Spotfire

A few weeks ago, I wrote a post on how to set up your machine to run Python Data functions in Spotfire. This post will follow up on that by explaining the next step — how to install Python packages in Spotfire. Read on to learn how.

Prerequisites

Depending on your version of Python/Spotfire, you may need to install pip. Pip is a package management system used to install and manage Python packages. You can’t install packages without it. I am running Spotfire 10.2 with Python 2.7.7, as shown in the data function dialog (from the Data menu – Data function properties – Register new), so I need to install pip. For more information, check out this link.

Another indicator pip is needed is the lack of a “Scripts” folder as shown here. If you don’t have this folder, install pip.

Installing Pip

To install pip, first find where Python is installed. You are looking for this executable. Copy the file location.

If you are having trouble finding it, type “python.exe” into your windows search.

Then, open up a command line. Just to be safe, I would run it as an administrator.

Next, we will run the two commands shown below, one after the other.

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

Note, if you aren’t in the command line at the right place, then you’ll get an error on the second command that looks like this. The errror says “invalid syntax”.

In that case, change the location where pip is being installed using “cd ” and the location of your python installation as shown below.

Installing Packages

With pip setup, you can install packages with the simple command shown below.

pip install pandas

Conclusion

Now, the package is ready to go. Call it from within a python data function in Spotfire as shown below.

Spotfire Version

Content created with Spotfire 10.2

If You Enjoyed This, Check Out…

1 thought on “How to Install Python Packages in Spotfire”

  1. Pingback: What is Python_Data_Function? » The Analytics Corner

Leave a Reply

Your email address will not be published. Required fields are marked *