2.1.2. Python Package for macOS/Linux/Windows

2.1.2.1. Generate SSH Key

AN/LT Utility requires an SSH key pair to run as a SSH service. To generate a SSH key pair, please open Command Prompt/PowerShell (Windows) or Terminal (macOS/Linux)

> ssh-keygen -t rsa

You will be prompted to save and name the key.

> Generating public/private rsa key pair. Enter file in which to save the key (/Users/USER/.ssh/id_rsa):

Press Enter to use the default name id_rsa.

Important

The filename of the key should be id_rsa. Please don’t use other filenames otherwise the application won’t be able to run.

Next you will be asked to create and confirm a passphrase for the key:

> Enter passphrase (empty for no passphrase):

Press Enter to skip passphrase.

> Enter same passphrase again:

Press Enter again to confirm passphrase.

This will generate two files, by default called id_rsa and id_rsa.pub in /Users/USER/.ssh

See also

You can read more about Generating SSH Key

2.1.2.2. Python Package for Win/macOS/Linux

Note

Skip this section, if you are a Windows (x64) user and don’t want to install AN/LT Utility as a Python package but simply want the .exe application,

AN/LT Utility is available to install via the Python Package Index. You can also install from the source file. The steps below will guide you through

2.1.2.2.1. Prerequisites

Before installing AN/LT Utility, please make sure your environment has installed:

2.1.2.2.1.1. Install Python

Important

AN/LT Utility requires Python >= 3.8.

AN/LT Utility requires that you download and install Python3 on your system.

Note

If you use Windows, remember to check Add python.exe to PATH.

../../_images/python_installation.png

After installation, open Command Prompt (Windows) or Terminal (macOS/Linux) and type python to verify your Python installation.

Check Python installation in Windows.
> python
Python 3.10.10 (tags/v3.10.10:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Check Python installation in macOS/Linux.
$ python3
Python 3.10.10 (v3.10.10:a58ebcc701, Feb 7 2023, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Note

🧐 If you are stuck with Python installation, seek help in Python 3 Installation & Setup Guide

2.1.2.2.1.2. Install PIP

Make sure pip is installed on your system. pip is the package installer for Python . You can use it to install packages from the Python Package Index and other indexes.

Usually, pip is automatically installed if you are:

If you don’t have pip installed, you can:

Install pip in Windows environment.
> py get-pip.py
Install pip in macOS/Linux environment.
$ python3 get-pip.py

See also

Read more details about this script in pypa/get-pip.

Read more about installation of pip in pip installation.

2.1.2.2.2. Install From PyPi Repository

pip is the recommended installer for AN/LT Utility. The most common usage of pip is to install from the Python Package Index using Requirement Specifiers.

Note

If you install AN/LT Utility using pip install xoa-utils, XOA Python API (PyPI package name xoa_driver) will be automatically installed.

Important

You can either install xoa-utils in your global Python namespace/package inventory or you can create a virtual Python environment to prevent polluting your global Python package inventory

2.1.2.2.2.1. If Install To Global Namespace

Install AN/LT Utility in Windows environment from PyPI.
> pip install xoa-utils            # latest version
> pip install xoa-utils==1.0.0     # specific version
> pip install xoa-utils>=1.0.0     # minimum version
Install AN/LT Utility in macOS/Linux environment from PyPI.
$ pip install xoa-utils            # latest version
$ pip install xoa-utils==1.0.0     # specific version
$ pip install xoa-utils>=1.0.0     # minimum version

2.1.2.2.2.2. If Install To Virtual Environment

Install AN/LT Utility in a virtual environment, so it does not pollute your global namespace.

For example, your project folder is called /my_xoa_project.

Install AN/LT Utility in a virtual environment in Windows from PyPI.
[my_xoa_project]> python -m venv .\env
[my_xoa_project]> .env\Scripts\activate

(env) [my_xoa_project]> pip install xoa-utils         # latest version
(env) [my_xoa_project]> pip install xoa-utils==1.0.0  # specific version
(env) [my_xoa_project]> pip install xoa-utils>=1.0.0  # minimum version
Install AN/LT Utility in a virtual environment in macOS/Linux from PyPI.
[my_xoa_project]$ python3 -m venv ./env
[my_xoa_project]$ source ./env/bin/activate

(env) [my_xoa_project]$ pip install xoa-utils         # latest version
(env) [my_xoa_project]$ pip install xoa-utils==1.0.0  # specific version
(env) [my_xoa_project]$ pip install xoa-utile>=1.0.0 # minimum version

Afterwards, your project folder will be:

After creating Python virtual environment
/my_xoa_project
    |
    |- env

2.1.2.2.3. Upgrade From PyPi Repository

To upgrade AN/LT Utility package from PyPI:

Upgrade AN/LT Utility in Windows environment from PyPI.
> pip install xoa-utils --upgrade
Upgrade AN/LT Utility in macOS/Linux environment from PyPI.
$ pip install xoa-utils --upgrade

Note

If you upgrade AN/LT Utility using pip install --upgrade xoa-utils, XOA Python API (PyPI package name xoa_driver) will be automatically upgraded.

2.1.2.2.4. Install Manually From Source

If you don’t have internet access, you can install AN/LT Utility manually from source, the steps are:

Step 1, make sure Python packages wheel and setuptools are installed on your system. Install wheel and setuptools using pip:

Install wheel and setuptools in Windows environment.
> pip install wheel setuptools
Install wheel and setuptools in macOS/Linux environment.
$ pip install wheel setuptools

Step 2, download the AN/LT Utility source distribution from AN/LT Utility Releases. Unzip the archive and run the setup.py script to install the package:

Install AN/LT Utility in Windows environment from source.
[xoa_core]> python setup.py install
Install AN/LT Utility in macOS/Linux environment from source.
[xoa_core]$ python3 setup.py install

Step 3, if you want to distribute, you can build .whl file for distribution from the source:

Build AN/LT Utility wheel in Windows environment for distribution.
[xoa_core]> python setup.py bdist_wheel
Build AN/LT Utility wheel in macOS/Linux environment for distribution.
[xoa_core]$ python3 setup.py bdist_wheel

Important

If you install AN/LT Utility from the source code, you need to install XOA Python API (PyPI package name xoa_driver) separately. This is because XOA Python API is treated as a 3rd-party dependency of AN/LT Utility. You can go to XOA Python API repository to learn how to install it.

2.1.2.2.5. Start AN/LT Utility

After installing the package and ensuring the SSH key in place, you can start AN/LT Utility simply by typing xoa-utils

Start AN/LT Utility SSH service.
> xoa-utils
(PID: 12345) AN/LT Utility SSH Service (1.1.0) running on 0.0.0.0:22622.
Start AN/LT Utility SSH service.
$ xoa-utils
(PID: 12345) AN/LT Utility SSH Service (1.1.0) running on 0.0.0.0:22622.

Note

If you want to run xoa-utils SSH service on a different port, do xoa-utils <port number>

2.1.2.2.6. Uninstall and Remove Unused Dependencies

pip uninstall xoa-utils can uninstall the package itself but not its dependencies. Leaving the package’s dependencies in your environment can later create conflicting dependencies problem.

We recommend install and use the pip-autoremove utility to remove a package plus unused dependencies.

Uninstall AN/LT Utility in Windows environment.
> pip install pip-autoremove
> pip-autoremove xoa-utils -y
Uninstall AN/LT Utility in macOS/Linux environment.
$ pip install pip-autoremove
$ pip-autoremove xoa-utils -y

See also

See the pip uninstall reference.

See pip-autoremove usage.