Setting up a Python development environment
This page walks you step by step, even if you are new to programming, through to running a program that controls INFINICAM from Python.
To use INFINICAM from Python, you use a dedicated library called pypuclib. pypuclib includes the SDK components (DLLs), so unlike C++, you don’t need to set up the SDK separately or install Visual Studio.
Follow the steps from top to bottom, and at the end you will have a program that connects to the camera. If something doesn’t work along the way, see Troubleshooting.
| Step | What you do | Time |
|---|---|---|
| 1 | Install Python | 10 min |
| 2 | Install pypuclib | 10 min |
| 3 | Check the installation without a camera | 5 min |
| 4 | Connect to the camera and run a program | 10 min |
0. What you need
Section titled “0. What you need”- A Windows 10 / 11 (64-bit) PC:
pypuclibis 64-bit only. - Administrator rights: needed for the firewall setting in step 4. If you don’t have them on a university PC, ask your administrator.
- An internet connection
- The INFINICAM camera and its cable: used in step 4. You can do everything up to step 3 without a camera.
1. Installing Python
Section titled “1. Installing Python”pypuclib supports Python 3.9 to 3.15. On this page, you install the latest Python 3.15 using the Python install manager provided by the official Python website.
-
Download the Python install manager
Open the Python downloads page (python.org) and click “Download Python install manager”. The installer file is downloaded.

-
Install the Python install manager
Double-click the downloaded file. When the following window opens, leave “Launch when ready” checked and click “Install Python”.

-
Initial configuration (answer the questions)
When the installation finishes, a black window (terminal) opens automatically and shows a series of questions. For each one, type
yand pressEnter.-
Allow long paths? (
Update setting now? [y/N])
Answer
y. This Windows setting allows file locations (paths) longer than 260 characters. It is needed when installing libraries such as PyTorch that contain files with very long paths. If you see “Do you want to allow this app to make changes to your device?”, choose “Yes”. The setting takes effect after you restart the PC, but you can continue without restarting. -
Add the commands folder to PATH? (
Add commands directory to your PATH now? [y/N])
Answer
y. This lets you use commands with a version number, such aspython3.15. -
Install Python itself? (
Install CPython now? [Y/n])
Answer
y. The latest Python (3.15) is downloaded and installed.
When you see
Installing Python 3.15.0.with a green check mark, followed byConfiguration checks completed., you are done.
Finally you are asked
View online help? [y/N](open the online help). Answernand close the window. -
-
Check the installation
Open a new Command Prompt: press
Win+R, typecmd, and pressEnter. A black window opens.Type the following command and press
Enter.Terminal window python -VIf you see a version starting with
Python 3.15., it worked (the last number may be different).Python 3.15.0
2. Installing pypuclib
Section titled “2. Installing pypuclib”-
Download the ZIP file
Download the pypuclib ZIP file from the Resources & Downloads page.
-
Extract the ZIP file
Right-click the downloaded ZIP file and choose “Extract All”.
When asked where to extract it, type
C:\and click “Extract”. A folder namedC:\pypuclibis created.If it looks like this, it was extracted correctly.
Directorypypuclib/ Folder created directly under
C:\Directorywheels/ Installation files (one for each Python version)
- pypuclib-(version)-cp39-cp39-win_amd64.whl
- …
- pypuclib-(version)-cp315-cp315-win_amd64.whl
Directorysamples/ Sample programs
- …
- verify_install.py Program to check the installation
- README.md Instructions
-
Install pypuclib
In Command Prompt, type and run the following 2 lines, one at a time. The first line moves to the extracted folder and the second installs it.
Terminal window cd C:\pypuclibTerminal window python -m pip install --no-index --find-links wheels pypuclibIf it ends with
Successfully installed pypuclib-..., it worked (...is the version number). -
Install the libraries used by the samples
The sample programs on this site also use the following 3 libraries for image calculations, display, and saving.
Library Used for NumPy Calculating with images as arrays of numbers OpenCV Displaying, saving, and processing images Pillow Saving images (used by some samples) There are 2 ways to install them. Do one of the two. Both download and install from the internet.
Method 1 (recommended): use the list file (requirements.txt)
If you have extracted the sample code bundle (
infinicam_projects) from the Resources & Downloads page toC:\, this method is easiest.C:\infinicam_projects\pythoncontains a file namedrequirements.txtthat lists the library names. In Command Prompt, run the following 2 lines, one at a time.Terminal window cd C:\infinicam_projects\pythonTerminal window python -m pip install --only-binary=:all: -r requirements.txt-r requirements.txtmeans “install the libraries listed in this file”.Method 2: type the library names
If you are not using the sample code bundle, or want to choose the libraries yourself, install them by name. In Command Prompt, run this one line.
Terminal window python -m pip install --only-binary=:all: numpy opencv-python pillowPart Meaning python -m pip installInstall with pip (the tool for installing Python libraries) --only-binary=:all:Accept only ready-to-use (prebuilt) files (see the warning below) numpy opencv-python pillowThe names of the libraries to install (separated by spaces) With either method, it worked if it ends with
Successfully installed .... The latest OpenCV 5 is installed.
3. Checking the installation (without a camera)
Section titled “3. Checking the installation (without a camera)”Use the checking program in the ZIP, verify_install.py, to make sure everything was installed correctly.
-
Run the checking program
In Command Prompt, run the following 2 lines, one at a time (if you are continuing from step 2-3, you can skip the first line).
Terminal window cd C:\pypuclibTerminal window python verify_install.py -
Check the result
It worked if every line has
[OK]and the last line saysall checks passed, like this.Python------[OK] version 3.15.0[OK] 64 bit yespypuclib--------[OK] import pypuclib[OK] loaded from C:\Users\...\site-packages\pypuclib.cp315-win_amd64.pyd[OK] PUCLIB.dll[OK] PUCUTIL.dll[OK] ICYUSB.dll[OK] IGETHERB.dll[OK] PICCLIB.dllSDK---[OK] initialise the SDK[OK] GPU decoding availableall checks passedIf a line has no
[OK], the reason is shown to the right of that line. See Troubleshooting as well.
4. Connecting to the camera
Section titled “4. Connecting to the camera”Now you create a program that connects to the camera and displays its serial number, resolution, and frame rate.
-
Allow traffic from the camera through the firewall (GbE-2 only, first time only)
Windows Firewall blocks
python.exefrom communicating with the camera. As is, the camera can be found, but connecting to it always fails.So you create one rule that allows traffic coming from the camera (
192.168.0.10).-
Type “PowerShell” in the Start menu, right-click PowerShell in the results, and choose “Run as administrator”.
-
Copy and paste the following line and press
Enter.Terminal window New-NetFirewallRule -DisplayName "INFINICAM GbE-2" -Direction Inbound -Protocol UDP -RemoteAddress 192.168.0.10 -Action Allow -Profile Any -
When you see
DisplayName : INFINICAM GbE-2andEnabled : True, you are done.
-
-
Check the camera with the checking program
Turn on the camera, connect it to the PC, and run the following 2 lines, one at a time, in Command Prompt.
Terminal window cd C:\pypuclibTerminal window python verify_install.py --cameraIt worked if, following the output from step 3, you see a
Camerasection like this andall checks passedat the end (the resolution and frame rate depend on the camera’s settings).Camera------[OK] network adapters 127.0.0.1, 192.168.0.1[OK] cameras found (deviceNo=None,deviceType=1,ipAddress=192.168.0.10)[OK] open the camera[OK] resolution 800x600[OK] sensor monochrome[OK] framerate 1000 fps (up to 1054 at this resolution)[OK] grab and decode (600, 800) uint8all checks passed -
Prepare a folder for your programs
In File Explorer, open
C:\infinicam_projectsand create a folder namedpythoninside it (createC:\infinicam_projectsfirst if it doesn’t exist). The explanations on this site assume all Python programs are saved here.If you have extracted the sample code bundle to
C:\, this folder already exists. Go on to the next step. -
Enter and save the program
Open Notepad, then copy and paste the following code.
from pypuclib import CameraFactory, PUCExceptionprint("Connecting to the camera...")try:# Connect to the GbE-2 at this IP addresscam = CameraFactory().create(ip="192.168.0.10")except PUCException as e:print("Error: could not connect to the camera.", e)raise SystemExit(1)print("Connected.")print("Serial number:", cam.serialNo())reso = cam.resolution()print("Resolution:", reso.width, "x", reso.height)print("Frame rate:", cam.framerate(), "fps")# Close the camera when you are done with itcam.close()print("Done.")Choose File > Save As from the menu, set the following, and click Save.
Item Value Location C:\infinicam_projects\pythonFile name hello_camera.pySave as type All files (*.*) Encoding UTF-8 -
Connect the camera and run it
In Command Prompt, run the following 2 lines, one at a time.
Terminal window cd C:\infinicam_projects\pythonTerminal window python hello_camera.pyIf you see output like the following, it worked (the serial number and frame rate depend on your camera).
Connecting to the camera...Connected.Serial number: 99334002087Resolution: 800 x 600Frame rate: 1000 fpsDone.You are now ready to control INFINICAM from Python.
5. Troubleshooting
Section titled “5. Troubleshooting”| Symptom / error | Likely cause | What to do |
|---|---|---|
| Double-clicking the downloaded file does nothing, or installation is blocked | Installing Store-style (.msix) apps is restricted on a university or company PC |
On Python Releases for Windows, download and run “Download MSI package” under “Python install manager”. If that still doesn’t install, ask your PC administrator |
| You closed the black window before answering the questions | — | Run py install --configure in Command Prompt to see the same questions again |
Typing python opens the Microsoft Store |
The Python install manager is not installed | Redo steps 1-1 to 1-3. Open a new Command Prompt after installing |
'python' is not recognized as an internal or external command... |
Same as above, or you are using a Command Prompt that was open before the installation | Open a new Command Prompt. If that doesn’t fix it, redo steps 1-1 to 1-3 |
python -V shows an older version such as Python 3.14.x |
Python installed another way earlier is still there and is found first | In Settings > Apps > Installed apps, uninstall the old Python 3.x.x (64-bit) and Python Launcher, then open a new Command Prompt |
ERROR: No matching distribution found for pypuclib |
The wheels folder has no file for your Python (an unsupported Python version, or 32-bit Python) |
Check the version with python -V and use 64-bit Python 3.9 to 3.15 |
ERROR: ... does not exist / “file not found” |
You have not moved to C:\pypuclib, or it was extracted somewhere else |
Run cd C:\pypuclib and try again. Check that the folder is not nested twice (step 2-2) |
ImportError: DLL load failed while importing pypuclib |
The Visual C++ Redistributable is not installed | Install vc_redist.x64.exe |
PUC_Initialize:13 couldn't load sdk modules. |
Some pypuclib DLLs are missing |
Move to C:\pypuclib and reinstall with python -m pip install --force-reinstall --no-index --find-links wheels pypuclib |
ModuleNotFoundError: No module named 'cv2' (or numpy) |
The libraries from step 2-4 are not installed | Do step 2-4 |
An error with an unfamiliar name, such as No matching distribution found for numphy |
A library name was mistyped | Copy and paste the step 2-4 command again. With Method 1 (requirements.txt), you don’t need to type names |
Error: could not connect to the camera. couldn't find any camera |
Camera power, cable, or IP address settings | Check PC requirements and network settings. Check that the IP address in the program matches the camera |
The camera is found but cannot be opened (the error contains PUC_OpenDevice2:9) |
Blocked by Windows Firewall, or another application is using the camera | Create the rule in step 4-1. Close other applications such as viewers (a camera can be used by only one application at a time) |
IndentationError / SyntaxError |
The indentation is off, or part of the code is missing | Copy and paste the code again |
No such file or directory when running python hello_camera.py |
Saved in the wrong place, or saved as hello_camera.py.txt |
Open C:\infinicam_projects\python in File Explorer and check the file name (step 4-4) |
When reporting a problem, please include the output of python verify_install.py --camera. It helps us investigate faster.
