Installation¶
Installing AVBlocks for Python takes three steps: install the avblocks Python package, download the AVBlocks Core native library (demo version) for your platform, and let the package know where the native library is. Builds of AVBlocks Core are available for both x64 and ARM64. Choose the section that matches your machine.
The AVBlocks Core build must match the architecture of the Python you run, not just the machine. Run python -c "import platform; print(platform.machine())" to check. For example, an x64 Python running under Rosetta on Apple Silicon needs the x64 build.
Python Package¶
The AVBlocks Python SDK is not distributed via PyPI. Install it directly from the avblocks-py GitHub repository. Python 3.12 or higher is required.
Install with pip¶
pip install git+https://github.com/avblocks/avblocks-py.git@3.4.0.2
Install with uv¶
From within your project directory:
uv add git+https://github.com/avblocks/avblocks-py.git --tag 3.4.0.2
This adds avblocks as a dependency in your pyproject.toml.
AVBlocks Core¶
The commands below extract the AVBlocks Core SDK into ./sdk. The native library is in ./sdk/lib/<arch>, where <arch> is x64 or arm64. For the available versions check the AVBlocks Core releases.
Linux¶
x64 (x86_64)¶
Use this build on x86_64 machines (uname -m prints x86_64).
AVBLOCKS_BASE_URL="https://github.com/avblocks/avblocks-core/releases/download"
AVBLOCKS_VERSION="v3.4.0-demo.1"
mkdir -p ./sdk
cd ./sdk
curl -L \
-o "avblocks-${AVBLOCKS_VERSION}-linux.tar.gz" \
"${AVBLOCKS_BASE_URL}/${AVBLOCKS_VERSION}/avblocks-${AVBLOCKS_VERSION}-linux.tar.gz"
Verify integrity (optional):
curl -L \
-o "avblocks-${AVBLOCKS_VERSION}-linux.tar.gz.sha256" \
"${AVBLOCKS_BASE_URL}/${AVBLOCKS_VERSION}/avblocks-${AVBLOCKS_VERSION}-linux.tar.gz.sha256"
sha256sum -c "avblocks-${AVBLOCKS_VERSION}-linux.tar.gz.sha256"
Extract:
tar -xzf "avblocks-${AVBLOCKS_VERSION}-linux.tar.gz"
cd ..
ARM64 (aarch64)¶
Use this build on ARM64 / aarch64 machines (uname -m prints aarch64).
AVBLOCKS_BASE_URL="https://github.com/avblocks/avblocks-core/releases/download"
AVBLOCKS_VERSION="v3.4.0-demo.1"
mkdir -p ./sdk
cd ./sdk
curl -L \
-o "avblocks-${AVBLOCKS_VERSION}-linux-arm64.tar.gz" \
"${AVBLOCKS_BASE_URL}/${AVBLOCKS_VERSION}/avblocks-${AVBLOCKS_VERSION}-linux-arm64.tar.gz"
Verify integrity (optional):
curl -L \
-o "avblocks-${AVBLOCKS_VERSION}-linux-arm64.tar.gz.sha256" \
"${AVBLOCKS_BASE_URL}/${AVBLOCKS_VERSION}/avblocks-${AVBLOCKS_VERSION}-linux-arm64.tar.gz.sha256"
sha256sum -c "avblocks-${AVBLOCKS_VERSION}-linux-arm64.tar.gz.sha256"
Extract:
tar -xzf "avblocks-${AVBLOCKS_VERSION}-linux-arm64.tar.gz"
cd ..
macOS¶
Intel (x86_64)¶
Use this build on Intel Macs (uname -m prints x86_64).
AVBLOCKS_BASE_URL="https://github.com/avblocks/avblocks-core/releases/download"
AVBLOCKS_VERSION="v3.4.0-demo.1"
mkdir -p ./sdk
cd ./sdk
curl -L \
-o "avblocks-${AVBLOCKS_VERSION}-darwin.zip" \
"${AVBLOCKS_BASE_URL}/${AVBLOCKS_VERSION}/avblocks-${AVBLOCKS_VERSION}-darwin.zip"
Verify integrity (optional):
curl -L \
-o "avblocks-${AVBLOCKS_VERSION}-darwin.zip.sha256" \
"${AVBLOCKS_BASE_URL}/${AVBLOCKS_VERSION}/avblocks-${AVBLOCKS_VERSION}-darwin.zip.sha256"
shasum -a 256 -c "avblocks-${AVBLOCKS_VERSION}-darwin.zip.sha256"
Extract:
unzip -q "avblocks-${AVBLOCKS_VERSION}-darwin.zip"
cd ..
Apple Silicon (arm64)¶
Use this build on Apple Silicon Macs (M1 and later; uname -m prints arm64).
AVBLOCKS_BASE_URL="https://github.com/avblocks/avblocks-core/releases/download"
AVBLOCKS_VERSION="v3.4.0-demo.1"
mkdir -p ./sdk
cd ./sdk
curl -L \
-o "avblocks-${AVBLOCKS_VERSION}-darwin-arm64.zip" \
"${AVBLOCKS_BASE_URL}/${AVBLOCKS_VERSION}/avblocks-${AVBLOCKS_VERSION}-darwin-arm64.zip"
Verify integrity (optional):
curl -L \
-o "avblocks-${AVBLOCKS_VERSION}-darwin-arm64.zip.sha256" \
"${AVBLOCKS_BASE_URL}/${AVBLOCKS_VERSION}/avblocks-${AVBLOCKS_VERSION}-darwin-arm64.zip.sha256"
shasum -a 256 -c "avblocks-${AVBLOCKS_VERSION}-darwin-arm64.zip.sha256"
Extract:
unzip -q "avblocks-${AVBLOCKS_VERSION}-darwin-arm64.zip"
cd ..
Windows¶
All scripts are PowerShell
x64 (AMD64)¶
Use this build when $env:PROCESSOR_ARCHITECTURE is AMD64.
$BaseUrl = "https://github.com/avblocks/avblocks-core/releases/download"
$Version = "v3.4.0-demo.1"
New-Item -Force -ItemType Directory ./sdk
cd ./sdk
curl.exe `
--location `
--output "avblocks-$Version-windows.zip" `
"${BaseUrl}/${Version}/avblocks-$Version-windows.zip"
Verify integrity (optional):
curl.exe `
--location `
--output "avblocks-$Version-windows.zip.sha256" `
"${BaseUrl}/${Version}/avblocks-$Version-windows.zip.sha256"
$downloadedHash = (Get-FileHash -Algorithm SHA256 "avblocks-$Version-windows.zip").Hash.ToLower()
$expectedHash = (Get-Content "avblocks-$Version-windows.zip.sha256").Split(' ')[0].ToLower()
if ($downloadedHash -eq $expectedHash) { Write-Host "Checksum OK!" } else { Write-Host "Checksum failed!" }
Extract:
Expand-Archive -Force -Path "avblocks-$Version-windows.zip" -DestinationPath .
cd ..
ARM64¶
Use this build on Windows on ARM, when $env:PROCESSOR_ARCHITECTURE is ARM64.
$BaseUrl = "https://github.com/avblocks/avblocks-core/releases/download"
$Version = "v3.4.0-demo.1"
New-Item -Force -ItemType Directory ./sdk
cd ./sdk
curl.exe `
--location `
--output "avblocks-$Version-windows-arm64.zip" `
"${BaseUrl}/${Version}/avblocks-$Version-windows-arm64.zip"
Verify integrity (optional):
curl.exe `
--location `
--output "avblocks-$Version-windows-arm64.zip.sha256" `
"${BaseUrl}/${Version}/avblocks-$Version-windows-arm64.zip.sha256"
$downloadedHash = (Get-FileHash -Algorithm SHA256 "avblocks-$Version-windows-arm64.zip").Hash.ToLower()
$expectedHash = (Get-Content "avblocks-$Version-windows-arm64.zip.sha256").Split(' ')[0].ToLower()
if ($downloadedHash -eq $expectedHash) { Write-Host "Checksum OK!" } else { Write-Host "Checksum failed!" }
Extract:
Expand-Archive -Force -Path "avblocks-$Version-windows-arm64.zip" -DestinationPath .
cd ..
Configure the Library Path¶
When avblocks is imported it looks for the native AVBlocks library in the following order:
The directory specified by the
AVBLOCKS_CORE_PATHenvironment variable.The
sdk/lib/<arch>directory relative to the package root.Common system library paths (
/usr/local/libon macOS and Linux,/usr/libon Linux).
If you installed the package with pip or uv, set AVBLOCKS_CORE_PATH to the sdk/lib/<arch> directory you extracted above.
macOS and Linux:
export AVBLOCKS_CORE_PATH=$PWD/sdk/lib/x64
Windows (PowerShell):
$env:AVBLOCKS_CORE_PATH = "$PWD\sdk\lib\x64"
Use arm64 in place of x64 on ARM64 machines. The native library file name depends on the platform:
Platform |
Library File |
|---|---|
macOS |
|
Linux |
|
Windows |
|
Assets¶
These demo audio and video assets are used as input for the AVBlocks samples. They are the same for all platforms and architectures.
mkdir -p ./assets
cd ./assets
curl -L \
-o avblocks_assets_v5.zip \
https://github.com/avblocks/avblocks-assets/releases/download/v5/avblocks_assets_v5.zip
unzip -q avblocks_assets_v5.zip
cd ..
On Windows (PowerShell):
New-Item -Force -ItemType Directory ./assets
cd ./assets
curl.exe `
--location `
--output avblocks_assets_v5.zip `
https://github.com/avblocks/avblocks-assets/releases/download/v5/avblocks_assets_v5.zip
Expand-Archive -Force -Path avblocks_assets_v5.zip -DestinationPath .
cd ..
Next steps¶
Set up a development environment for your platform: Linux, macOS or Windows.