On this page

Stuck? Open a support ticket and the barKoder team will help. Open a ticket

Python Installation

Before you start #

Requirements #

Basic requirements #

  • A 64-bit operating system. The Linux steps below are for an x86-64 CPU; Windows and macOS have their own sections further down. As a general guideline Ubuntu 22.04 or newer is recommended. Install commands given below assume a Debian distro is used (but are not limited to).
  • python3 (version 3.11 or newer; contact us if you need support for older versions)
  • Most Linux distributions come with Python. If yours does not, install it:

Install python3 #

Shell
sudo apt-get install python3

Install pip #

The sample app needs OpenCV and NumPy, installed with pip:

Shell
sudo apt install python3-pip
//or
sudo dnf install python3-pip
//depending on the linux distribution

Install openCV-python, numpy and other sample app requirements #

Install OpenCV, NumPy and the sample's other packages:

This package has to be installed for the same version of python that will be used. So if you use python3.11 you need to install it for python3.11
Shell
pip install opencv-python
pip install numpy
//to change the name of the running app
pip install setproctitle

Install curl (optional) #

Curl might be needed for licensing, depending on the type of license used. In particular, curl from snap is required (ref https://snapcraft.io/curl). It can be installed with:

sudo apt install snapd

sudo snap install curl

Using a specific python version #

If you need to use a specific python version, i.e. running the sample app like so:

Shell
python3.11 run.py

you may need to install a side-by-side python version, different than the one you have, for example:

Shell
sudo apt-get install python3.11
Shell
sudo dnf install python3.11

and OpenCV for Python should also be available under that version, and can be installed with:

Shell
python3.11 -m pip install opencv-python
if you can't run this command and your system complains that there is no module named pip you need to upgrade your pip by running
Python
python3.11 -m pip install --upgrade --ignore-installed pip
//ignore-installed is in case your pip was installed by the system package manager

Eventually, when running the sample app (which you can download from our repository by previously registering on the barKoder Developer Portal) if you get an error like this:

JavaScript
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

You are probably on a RedHat distribution and you may need to add this:

Shell
sudo yum install mesa-libGL

1. Add the package #

Get the library #

From the barKoder Developer Portal #

Download the Python library from Downloads in the barKoder Developer Portal and unzip it: it has a sample app that runs as it is.

From GitHub #

Or clone it from GitHub; its README says how to run it.

Install on Windows #

Download the Windows package (x86 64-bit) and extract it. You need Windows 10 or 11 and Python 3.11 or higher.

Install the SDK and the sample's dependencies:

POWERSHELL
cd dist
python -m pip install barkodersdk-1.0-cp311-abi3-win_amd64.whl
python -m pip install opencv-python numpy

Run the sample:

POWERSHELL
cd barkoder_sample
python run.py

The package holds Barkoder.py and the SDK wheel (barkodersdk-*.whl), the sample run.py, a test image qr.bmp and a short README.

Install on macOS #

Download the macOS package (universal: Intel x86 64-bit and Apple silicon ARM64) and extract it. You need macOS 11 Big Sur or newer and Python 3.11 or higher. The package is a signed disk image, BarkoderSDK-py311-macos-universal.dmg.

Let the SDK files run, then install the sample's dependencies:

Shell
chmod +x *.{so,py}
python3 -m pip install opencv-python numpy

Run the sample:

Shell
python3 run.py

The disk image holds Barkoder.py and BarkoderSDK.so, the sample run.py, a test image qr.bmp and a short README. The sample code and the API are the same on Linux, Windows and macOS.