Basler Pylon 5 API from Python

You can control Basler cameras from Python using the Pylon 5 API via Cython with this procedure for Linux, Mac, and Windows. The Raspberry Pi and some other ARM systems are also covered by Basler camera drivers. PyPylon (the Python Basler interface) is Python 2.7 and Python 3 compatible.

Install Basler Python API

  1. Install Pylon 5 with SDK/Developer options. For the Raspberry Pi 3, choose ARM 32-bit hardfloat Debian installer.
    gdebi pylon_5*.deb
    

    This puts icons in your Linux menu under “Sound & Video/pylon Viewer” and “other/pylon IP Configurator”.

  2. setup PyPylon:
    git clone https://github.com/mabl/PyPylon
    cd PyPylon
    python -m pip install -e .
    
  3. PyPylon example scripts

Live preview

ARM and x86 Linux: run Basler Pylon GUI live viewer:

/opt/pylon5/bin/PylonViewerApp

Notes

Fix error

ImportError: PyPylon/pypylon/cython/factory.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZTINSt8ios_base7failureB5cxx11E

conda install libgcc

RuntimeError: Payload data has been discarded. Payload data can be discarded by the camera device if the available bandwidth is insufficient.

Basler claims root is needed but that didn’t solve it for me on an x64 Linux laptop. RichardLangFromNZ fork of PyPylon didn’t help either.


The PyPylon Python Basler API is used extensively by the Open Source Cytometry Project.

Leave a Comment