aqtinstall: Unofficial Qt Installer

3.3.0 · active · verified Wed Apr 15

aqtinstall is a Python library and command-line tool for installing specific versions of Qt, Qt tools, and add-ons directly from Qt's official servers. It provides an unofficial, robust, and programmatic way to manage Qt installations, particularly useful in CI/CD environments. The current version is 3.3.0, and it generally follows a monthly or bi-monthly release cadence for minor updates and bug fixes.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to programmatically install a specific Qt version and optional modules using `aqtinstall.aqt.run_install`. It sets up an installation directory and handles potential errors. Remember to adjust `os_name` and `arch` to match your target system. For commercial Qt versions, you might need to provide username and password as environment variables or directly.

import os
from aqtinstall.aqt import run_install

# Define installation parameters
qt_version = '6.5.0'
os_name = 'linux'
arch = 'gcc_64' # Example for Linux; 'win64_msvc2019_64' for Windows, 'macos' for macOS
modules = ['qtcharts', 'qtlottie'] # Optional: specific modules
install_dir = os.path.join(os.environ.get('HOME', '.'), 'qt_test_install')

print(f"Attempting to install Qt {qt_version} for {os_name}/{arch} into {install_dir}")

try:
    run_install(
        tool='qt',
        version=qt_version,
        os_name=os_name,
        arch=arch,
        output_dir=install_dir,
        modules=modules,
        # For commercial Qt versions, specify an account:
        # username=os.environ.get('QT_ACCOUNT_USERNAME', ''),
        # password=os.environ.get('QT_ACCOUNT_PASSWORD', ''),
        # Use dry_run=True to test parameters without downloading
        # dry_run=True
    )
    print(f"Qt {qt_version} successfully installed to {install_dir}")
except Exception as e:
    print(f"Error during Qt installation: {e}")
    print("Please check your OS, architecture, Qt version, network, and permissions.")

# Example of using AqtInstaller class (more granular control)
# installer = AqtInstaller(ArchivesPath(qt_version, os_name, arch, tool='qt'))
# installer.install(install_dir, modules=modules)

view raw JSON →