Setup

Python development needs some setup before be able to use our SDK. You can find in this section a detailed instructions of how to setup your Python environment on Linux, MAC or Windows.

Python on Linux

PythonNet dependencies installed and configured for Ubuntu 20.04

  • Install Mono version 6.10.0
sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal/snapshots/6.10.0 main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list && apt-get update
sudo apt update
sudo apt install mono-devel

for other linux distributions, please see https://www.mono-project.com/download/stable/#download-lin and https://www.mono-project.com/docs/getting-started/install/linux/#accessing-older-releases

  • Additional things to install:
sudo apt install python3-pip clang libglib2.0-0 build-essential librdkafka-dev
python3 -m pip install pycparser

As of now, some dependencies do no correctly install for librdkafka on ubuntu 20.04. These need to be manually installed with the following script, as not available pre-built.

mkdir kafkadownloads
cd kafkadownloads
curl http://ftp.us.debian.org/debian/pool/main/g/glibc/multiarch-support_2.19-18+deb8u10_amd64.deb -O
md5=$(md5sum multiarch-support_2.19-18+deb8u10_amd64.deb | cut -b 1-32)
if [[ "$md5" != 'c3146eaa5ba5f757d1088b5217c2a313' ]]; then
echo "Invalid Md5Hash for multiarch-support: $md5" 1>&2
exit 1
fi
dpkg -i multiarch-support_2.19-18+deb8u10_amd64.deb

curl http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb -O
md5=$(md5sum libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb | cut -b 1-32)
if [[ "$md5" != "02124c56a3fa64ab3f9a225f450dc0ac" ]]; then
echo "Invalid Md5Hash for libssl: $md5" 1>&2
exit 1
fi
dpkg -i libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
cd ..
rm -rdf kafkadownloads

Create new python environment

We highly suggest to use a python virtual environment, as the Quix streaming package currently relies on some dll redirecting, which is achieved by adding a file to your python environment. This is done automatically, but to avoid any complication with other python applications you might want to use relying on similar techniques, a virtual environment is advised.

To create a new virtual environment, execute the following in a terminal at your desired location:

python3 -m pip install virtualenv
python3 -m virtualenv env
chmod +x ./env/bin/activate
source ./env/bin/activate

You will know you succeeded in activating the environment if your terminal line starts with (env). Future steps will assume you have the virtual environment activated or happy to install into global python.

Install samples requirements

In the same terminal you activated the virtual environment, navigate to the folder where requirements.txt is located and execute

python3 -m pip install -r requirements.txt --extra-index-url https://pkgs.dev.azure.com/quix-analytics/53f7fe95-59fe-4307-b479-2473b96de6d1/_packaging/public/pypi/simple/

Python on Mac

Install dependencies

You have the option of installing dependencies via script or manually.

Install dependencies via script

In this folder you will find quix-dependency-installer-mac.sh, which installs all necessary requirements. To run it, copy-paste the following into a terminal:

sed -i '' "s/$(printf '\r')\$//g" ./quix-dependency-installer-mac.sh && ./quix-dependency-installer-mac.sh

Install dependencies manually

PythonNet dependencies installed and configured
  • Install Brew package manager (from brew.sh)
  • Install Mono Version
brew install mono
export PATH=/Library/Frameworks/Mono.framework/Versions/Current/Commands:${PATH}
  • Additional things to install:
brew install pkg-config
python3 -m pip install wheel
python3 -m pip install pycparser

Create new python environment

We highly suggest to use a python virtual environment, as the Quix streaming package currently relies on some dll redirecting, which is achieved by adding a file to your python environment. This is done automatically, but to avoid any complication with other python applications you might want to use relying on similar techniques, a virtual environment is advised.

To create a new virtual environment, execute the following in a terminal at your desired location:

python3 -m pip install virtualenv
python3 -m virtualenv env
chmod +x ./env/bin/activate
source ./env/bin/activate

You will know you succeeded in activating the environment if your terminal line starts with (env). Future steps will assume you have the virtual environment activated or happy to install into global python.

Install samples requirements

In the same console you activated the virtual environment, navigate to the folder where requirements.txt is located and execute

python3 -m pip install -r requirements.txt --extra-index-url https://pkgs.dev.azure.com/quix-analytics/53f7fe95-59fe-4307-b479-2473b96de6d1/_packaging/public/pypi/simple/

Python on Windows

  • Install latest .Net Core runtime (https://dotnet.microsoft.com/download/dotnet-core/current/runtime)

Create new python environment

We highly suggest to use a python virtual environment, as the Quix streaming package currently relies on some dll redirecting, which is achieved by adding a file to your python environment. This is done automatically, but to avoid any complication with other python applications you might want to use relying on similar techniques, a virtual environment is advised.

To create a new virtual environment, execute the following in a command line at your desired location:

pip install virtualenv
python -m virtualenv env
"env/Scripts/activate"

You will know you succeeded in activating the environment if your command line starts with (env). Future steps will assume you have the virtual environment activated or happy to install into global python.

Note: You might need to use a new command line after installing Python, because PATH isn't refreshed for existing command lines when something is installed.

Install samples requirements

Open a console in the folder where requirements.txt is located and execute

pip install -r requirements.txt --extra-index-url https://pkgs.dev.azure.com/quix-analytics/53f7fe95-59fe-4307-b479-2473b96de6d1/_packaging/public/pypi/simple/