Installing PySpin for the Spinnaker SDK on Windows and Linux

The Spinnaker SDK supports programming in C++, C#, and C languages. For Python users, a PySpin wrapper must also be installed. The following application note describes the steps to install PySpin for use with the Spinnaker SDK.

To install PySpin:

Step 1 Step 2 Step 3 Step 4
Download the Spinnaker SDK and PySpin Install the Full Spinnaker SDK Download and Install Python Install and Configure PySpin (Windows)
Install and Configure PySpin (Linux)

We do not recommend installing any of these components from other sources.


 

 

Step 1—Download the Spinnaker SDK and PySpin

a. Navigate to the Spinnaker downloads page. If you are not already logged in, you are prompted to do so.

b. Download the full Spinnaker SDK version for your operating system.

c. Download the PySpin version that matches your operating system and version of Python.

Note: Python versions supported may vary between operating systems.


 

 

Step 2—Install the full Spinnaker SDK

Follow the instructions of the install wizard.


 

 

Step 3—Download and Install Python

a. If you do not have Python already installed, navigate to https://www.python.org/ to download and install your Python version.

The following Windows example uses Python 3.10.11 64-bit from Python Releases for Windows | Python.org.

b. Select Customize installation:

PySpin-Install-002.jpg

c. Select all Optional Features:

PySpin-Install-003.jpg

d. Select Advanced Options:

You do not need to worry about setting the PATH environment variable for your Python installation if you select the option Add Python to environment variables.

PySpin-Install-004.jpg

e. You should get a successful install confirmation:

PySpin-Install-005.jpg


 

 

Step 4—Install and Configure PySpin (Windows)

a. Once Python is successfully installed, go to the install directory and create a new folder called PySpin.

PySpin-Install-006.jpg

b. Copy the PySpin zip file downloaded in Step 1 into this folder and extract all files.

c. Verify your downloaded wheel matches your Python version. 

PySpin-Install-007.jpg

d. From a command line, update and install dependencies for your <python version>.

<python version> -m ensurepip
<python version> -m pip install --upgrade pip numpy matplotlib

Notes:

  • NumPy version 1.15 or later is required for PySpin.
  • Matplotlib is not required for the library itself but is used in some of our examples to highlight possible usages of PySpin.
  • Pillow is recommended for the best support of matplotlib output image file formats. Note: some versions of Pillow might NOT support some Python versions. The full list of supported Pillow versions given a Python version can be found here:
    https://pillow.readthedocs.io/en/stable/installation.html#notes

e. For a Python 3.10 example, install a supported Pillow using the following command:

py -3.10 -m pip install Pillow==9.2.0

f. Run the following command to install PySpin to your associated Python version. This command assumes you have your PATH variable set correctly for Python:

<python version> -m pip install spinnaker_python-3.x.x.x-cp3x-cp3x-win_amd64.whl

PySpin-Install-008.jpg

After installation, you can run PySpin examples directly from the command prompt.

For example, if PySpin for Python 3.10 is installed, use the following to run an example:

ex.py -3.10 Examples\Python3\AcquireAndDisplay.py

PySpin-Install-009.jpg


 

 

Step 4—Install and Configure PySpin (Linux)

a. Check that pip is available for your Python version by running the following command:

sudo apt-get install python-pip python3-pip

b. Update and install dependencies for your Python version: numpy and matplotlib.

sudo python3.10 -m pip install --upgrade numpy matplotlib

Notes:

  • NumPy version 1.19 or later for Ubuntu 20.04 or version 1.21 or later for Ubuntu 22.04 is required.
  • Matplotlib is not required for the library itself but is used in some of our examples to highlight possible usages of PySpin.
  • Pillow is recommended for the best support of matplotlib output image file formats. Note: some versions of Pillow might NOT support some Python versions. The full list of supported Pillow versions given a Python version can be found here:
    https://pillow.readthedocs.io/en/stable/installation.html#notes

c. For a Python 3.10 example, install a supported Pillow using the following command:

python3.10 -m pip install Pillow==9.2.0

d. Ensure that the corresponding version of the Spinnaker SDK Debian packages and their prerequisites are installed (for example, install the 3.0.0.0 packages if the wheel version is 3.0.0.0).

e. Install the wheel for the specific Python version:

sudo python3.10 -m pip install spinnaker_python-3.x.x.x-cp310-cp310-linux_x86_64.whl

PySpin-Install-010.png

The examples are located in the Examples folder of the extracted tarball.

For example, if PySpin for Python 3.10 is installed, use the following to run an example:

ex. python3.10 Examples/Python3/Acquisitionl.py

PySpin-Install-011.png

Related Articles