IC Imaging Control 4 in Python Virtual Environment

From The Imaging Source Knowledgebase
Jump to navigation Jump to search

This article describes how to use IC Imaging Control 4 and the IC 4 GenTL Producer in a virtual environment (venv) for Python in Linux. It is recommended to read Python Virtual Environments and Packages additionally.

Before a Virtual Environment is created, the appropriate IC 4 GenTL Producer is installed from https://www.theimagingsource.com. Thee downloaded packages are usually copied to ‘Downloads’.

cd ~/Downloads
sudo apt install ./ic4-gentl-driver-....deb

After installing the IC 4 GenTL Producer, the virtual environment is created. In this example, it is created directly in the user folder, hence the "cd ~".

cd ~
python -m venv ./ic4-test

The ‘ic4-test’ directory must not yet exist. It is created automatically.

The new virtual environment is activated with the following line:

source ./ic4-test/bin/activate

The prompt in the terminal is now preceded by the name of the virtual environment directory. Here it is ‘(ic4.test)’

Installation of von IC 4:

pip3 install imagingcontrol4

Install the IC 4 samples::

git clone https://github.com/TheImagingSource/ic4-examples.git

Run the IC 4 Python Demoapp:

The Qt6 Demoapp sample may needs the package libxcb-cursor0. It ist installed by:

sudo apt install libxcb-cursor0

The Demoapp script is in "ic4-examples/python/qt6/demoapp"

cd ic4-examples/python/qt6/demoapp

The folder contains the file ‘requirements.txt’, which is used to install all packages for the demoapp that have not yet been installed:

pip install -r requirements.txt

Now the Demoapp is started as follows:

python demoapp.py

For further questions, please use our contact form