Running PySpin (FLIR) Example gives Error "module 'pyspin' has no attribute 'System'"

7.3k views Asked by At

I recently installed the Spinnaker SDK and the PySpin library for use with Flir cameras (I followed the instructions on the website). However, when I tried to run the supplied Acquisition.py example file, I got the error "module 'pyspin' has no attribute 'System'"

A few other notes:

  1. For some reason, when I used pip to install PySpin, the module was installed with the name "pyspin" rather than "PySpin", even though it was written in the script as PySpin (e.g. import PySpin). Initially the script wasn't even able to find the module until I changed all the library names in the script to the lowercase version.
  2. I had an unrelated library, also called PySpin, on my computer from before. I used pip to uninstall the old PySpin (python -m pip uninstall PySpin) when I realized this and then reinstalled the "proper" library.
3

There are 3 answers

0
emu On

This problem seems to continue to exist: a library called 'pyspin' can be installed via pip, but that's not the correct library for spinnaker-operated hardware: "PySpin" - i.e. there seems to be a naming conflict.

The 'pyspin' - lowercase, seems to be a library that only generates a spinning text graphic, and nothing else - it has nothing at all to do with FLIR - and that's why you cant access the system etc. calls.

Typically, the advice to install the FLIR PySpin library seems to be "go and get the entire spinnaker package from FLIR and install it", though having done that process upwards of six times, I've still not managed to obtain the correct 'PySpin' library, and as far as I can find out, it's not available anywhere else.

If anyone at all can point to a github repo, FLIR repository or anything at all that has the correct 'PySpin' library, please post it here.

0
Ebin Zacharias On

As the answers suggest, naming conflicts attribute to this error. Correctly installing the PySpin package from Spinnaker solved the issue:

  1. Go to the extracted folder and you will see a folder named Python
  2. Check that pip is available
  3. Install wheel for the specific version of python in your system.

For example:

# For Python 3.6, site wide:
$ sudo python3.6 -m pip install spinnaker_python-2.x.x.x-cp36-cp36m-linux_x86_64.whl
0
Quentin On

Assuming that you already installed the latest version of the Spinnaker SDK, you have to download the Python Spinnaker SDK package (for me it was sitting in the Linux -> Ubuntu 20.04 -> python repository of this website: https://flir.app.boxcn.net/v/SpinnakerSDK).

The version you should download depends on your system architecture (use "uname -m" in the terminal to find out).

Once you downloaded the archive, simply extract it anywhere and follow the installation procedure in README.txt (for me, it meant running python3.8 -m pip install --user spinnaker_python-2.x.x.x-cp38-cp38-linux_x86_64.whl after moving the .whl file to /opt/spinnaker/doc, where x.x.x.x should match the name of the file in the archive AND the version of the Spinnaker SDK that you currently have installed).

Once the installation is successful, you can use the PySpin library in Python.