Setup your local environment

The Quix Portal offers you an online IDE, ready to use without any additional setup to develop or deploy your applications. However, you might sometimes want to work with your application in a local IDE.

In such cases, Python development needs some setup before you can use our SDK. In this section are detailed instructions of how to set up your Python environment on Linux, Mac or Windows.

This guide assumes you have already cloned a project of your own or download a library sample provided within the platform. In addition some stages may require files from GitHub.

Make sure you’re using Python version 3.7>=, <3.9

Install Dependencies

To get started, install the SDK dependencies.

  • MacOS Intel

  • MacOS M1

  • Windows

  • Linux

You can install dependencies via a script or manually.

Install dependencies via script

Download the script named quix-dependency-installer-mac.sh from GitHub, which installs all necessary requirements. Download the project then run the script by copy-pasting the following into a terminal from the project’s top directory.

chmod +x ./quix-dependency-installer-mac.sh && ./quix-dependency-installer-mac.sh

Install dependencies manually

  • Install and configure PythonNet dependencies

    • Install the Brew package manager (from brew.sh). To add brew to your path:

      echo "export PATH=/usr/local/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile && echo "Worked" || echo "Failed"
    • Install Mono Version

      brew install mono
      echo "export PATH=/Library/Frameworks/Mono.framework/Versions/Current/Commands:$PATH" >> ~/.bash_profile && source ~/.bash_profile && echo "Worked" || echo "Failed"
      echo "export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig:$PKG_CONFIG_PATH" >> ~/.bash_profile && source ~/.bash_profile && echo "Worked" || echo "Failed"
  • Additional things to install:

    brew install pkg-config
    python3 -m pip install wheel
    python3 -m pip install pycparser

You can install dependencies via a script or manually.

Install dependencies via script

Download the script named quix-dependency-installer-mac.sh from GitHub, which installs all necessary requirements. Download the project then run the script by copy-pasting the following into a terminal from the project’s top directory.

chmod +x ./quix-dependency-installer-mac.sh && ./quix-dependency-installer-mac.sh

Install dependencies manually

  • Install and configure PythonNet dependencies

    • Install the Brew package manager (from brew.sh). To add brew to your path:

      echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile && echo "Worked" || echo "Failed"
    • Install rosetta

      sudo softwareupdate --install-rosetta --agree-to-license
    • Install Mono Version

      curl https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.122.macos10.xamarin.universal.pkg -O
      monoPkgPath=./MonoFramework-MDK-6.12.0.122.macos10.xamarin.universal.pkg
      sudo installer -pkg $monoPkgPath -target /
      echo "export PATH=/Library/Frameworks/Mono.framework/Versions/Current/Commands:$PATH" >> ~/.bash_profile && source ~/.bash_profile && echo "Worked" || echo "Failed"
      echo "export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig:$PKG_CONFIG_PATH" >> ~/.bash_profile && source ~/.bash_profile && echo "Worked" || echo "Failed"
  • Additional things to install:

    brew install pkg-config
    python3 -m pip install wheel
    python3 -m pip install pycparser
Because of the variability between linux distributions we highly recommend using a Docker environment ( see Docker setup ) in case you experience any issues during the installation.
  • Install and configure PythonNet dependencies - 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 the Mono current release page and older Releases page

  • Additional things to install:

sudo apt install python3-pip clang libglib2.0-0 build-essential librdkafka-dev
python3 -m pip install pycparser

Currently, some dependencies do not correctly install for librdkafka on ubuntu 20.04. These need to be manually installed with the following script, as they are 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

cd ..
rm -rdf kafkadownloads

echo "deb http://security.ubuntu.com/ubuntu bionic-security main" >> /etc/apt/sources.list
apt-get update
apt-get install libssl1.0.0

Create New Python Environment

It’s good practice to use a python virtual environment and it is doubly true when using the Quix streaming library. The library currently relies on some dll redirecting, which is achieved by adding a file to your python environment. This is done automatically, but if you have other python application(s)/package(s) that also rely on similar redirection then a virtual environment is advised.

  • MacOS

  • Windows

  • Linux

To create a new virtual environment, execute the following in a terminal at your desired location (such as the root folder of the downloaded sample):

python3 -m pip install virtualenv
python3 -m virtualenv env --python=python3.8.7
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 are happy to install globally.

To create a new virtual environment, execute the following in a terminal at your desired location (such as the root folder of the downloaded sample):

pip install virtualenv
python -m virtualenv env --python=python3.8
"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 are happy to install globally.

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.

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 --python=python3.8
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 are happy to install globally.

Install code requirements

  • MacOS

  • Windows

  • Linux

In the same terminal you activated the virtual environment, navigate to the folder where requirements.txt (in the sample you downloaded) is located and execute the following:

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/

In the same console you activated the virtual enviornment, navigate to the folder where requirements.txt (in the sample you downloaded) is located and execute the following:

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

In the same terminal you activated the virtual environment, navigate to the folder where requirements.txt (in the sample you downloaded) is located and execute the following:

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/

Your environment should be ready to run the code!

  • MacOS

  • Windows

  • Linux

python3 main.py
python main.py
python3 main.py