Setting up Python

Check that both pip and at least version 3.6 of Python are installed. QuadlogSCADA and some of the Python modules make use of async/await syntax that earlier versions of Python lack.

Select Python Interpreter

List and check the current versions of Python installed:

$ ls -w40 /usr/bin/python3.*

/usr/bin/python3.7
/usr/bin/python3.7-config
/usr/bin/python3.7m
/usr/bin/python3.7m-config
/usr/bin/python3.8
/usr/bin/python3.8-config

Select the highest Python version to set as the system default. Set the alternatives as follows and then check.

$ update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
$ python --version

Python Packages

Install the following Python packages.

$ apt install python3-dev
$ apt install python3-venv
$ apt install python3-pip

Then upgrade pip to ensure it is the latest version.

$ pip3 install -U pip

It might be that some additional Python modules need installing, such as distutils.

$ apt install python3-distutils

Package Management Tool

Poetry is a dependency management tool for Python and it is used to assist in the management of setting up quadlogSCADA source files and its dependencies.

For information and usage on Poetry: https://python-poetry.org/docs/

First install ‘curl’ so that Poetry can be downloaded and then self install.

$ apt install curl
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

After Poetry installation is complete, a message will be displayed to set the path for Poetry. This can be done by either re-logging in the user session or by command shown below.

$ source $HOME/.poetry/env

Set Poetry for local virtual environment to exist within the project.

$ poetry config virtualenvs.path /home/quadlog/quadlog-scada --local
$ poetry config virtualenvs.in-project true

List the current configuration for Poetry and check that it appears as below.

$ poetry config --list

cache-dir = "/home/quadlog/.cache/pypoetry"
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/quadlog/.cache/pypoetry/virtualenvs