pypylon

raw JSON →
26.3.1 verified Mon Apr 27 auth: no python

The official Python wrapper for the Basler pylon Camera Software Suite, enabling control of Basler cameras via Python. Current version is 26.3.1, released around April 2026. The library follows Basler's pylon release cadence, with major version bumps aligning with pylon SDK updates.

pip install pypylon
error ModuleNotFoundError: No module named 'pypylon'
cause pypylon not installed or installed in wrong environment.
fix
Run: pip install pypylon
error pypylon.pylon.PylonException: The pylon transport layer is not available. (Timeout)
cause pylon SDK not properly installed or camera not connected.
fix
Ensure pylon SDK is installed (check with 'pylon-config --version' on Linux) and camera is connected via USB/GigE.
error ImportError: libpylonbase-6.3.so: cannot open shared object file: No such file or directory
cause Missing pylon SDK system libraries on Linux.
fix
Install the pylon SDK from Basler, then set LD_LIBRARY_PATH to the pylon lib directory, e.g., export LD_LIBRARY_PATH=/opt/pylon/lib64:$LD_LIBRARY_PATH
breaking pypylon 26.x drops support for Python 3.8 and older; requires pylon SDK 6.x or later. Older 4.x versions are incompatible with newer pylon SDKs.
fix Use pypylon 26.x with pylon SDK >=6.3. Check Basler's compatibility matrix.
breaking The pypylon package name changed from 'pypylon' to 'pypylon' but the import module is 'pylon' (not 'pypylon'). Common mistake: 'import pypylon' fails because pypylon is a namespace package without a top-level module.
fix Always use 'from pypylon import pylon' or 'import pypylon.pylon as pylon'.
gotcha On Linux, the pylon SDK must be installed separately (via Basler's website) because pypylon depends on system-wide pylon libraries. pip install does not include them.
fix Download and install the pylon SDK for Linux from Basler's support site before pip installing pypylon.
gotcha PylonImage objects returned by RetrieveResult() must be released to avoid memory leaks. Use 'with' context manager or call Release() manually.
fix Use: with camera.RetrieveResult(5000) as grab: ...

Basic camera enumeration, opening, grabbing one image, and closing.

from pypylon import pylon

# Enumerate cameras
devices = pylon.TlFactory.GetInstance().EnumerateDevices()
camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
camera.Open()
print("Camera model:", camera.GetDeviceInfo().GetModelName())
camera.StartGrabbing(1)
grab = camera.RetrieveResult(5000)
if grab.GrabSucceeded():
    img = grab.Array
    print("Image shape:", img.shape)
camera.Close()