Skip to content

Conda installation

Note

If you already set your license key, skip ahead to Step Two.

1. Set license key

After you receive your license key via email, place it in the following location: ~/.leip/license.key.

If you'd like, export your license key as an environment variable:

export LEIP_LICENSE_KEY=<your-license-key>
And then run:

mkdir -p ~/.leip && echo "$LEIP_LICENSE_KEY" > ~/.leip/license.key
Alternative license key configurations

If you prefer, you can simply set LEIP_LICENSE_KEY as an environment variable. You can also place the key in a .leip/license.key file in your project directory: "$PWD"/.leip/license.key.

2. Install prerequisites

apt-get install libcurl4 llvm-14-dev g++-aarch64-linux-gnu

3. Set authentication key

To install packages from Latent AI, you'll need to strip the prefix from your license key and set an environment variable for authentication.

export LEIP_LICENSE_KEY=$(cat ~/.leip/license.key)
export LEIP_AUTH_KEY="${LEIP_LICENSE_KEY#key/}"

4. Create a conda environment

For Advanced Users

The conda setup is intended for advanced users. Please consult the conda documentation for details on installing conda and creating a conda environment from an environment.yml file.

You can use the provided YAML as a template to create variants for different version of Python; just edit the YAML directly. Please note, however, that Python versions are constrained and must be within 3.10-3.13 majors.

You can copy or download the following environment.yml to create a conda environment:

name: latentai-forge
channels:
  - nvidia/label/cuda-12.6.0
  - conda-forge
  - defaults
dependencies:
  - jupyter
  - libstdcxx-ng
  - nvidia::cuda-tools
  - python=3.10
  - pip
  - pip:
      - --extra-index-url https://latentai:${LEIP_AUTH_KEY}@packages.latentai.io/pypi/simple/
      - leip-forge

Then create the environment with the following command:

conda env create -f environment.yml

And then activate the environment:

conda activate latentai-forge

Install Android Cross Compiler (Optional)

If you plan to compile models for Android devices, you'll need to install the Android NDK (Native Development Kit) and related tools. This setup includes:

  • Android SDK Tools
  • Android NDK (version 21.3.6528147 by default)
  • CMake (version 3.6.4111459)
  • Required build tools and platform tools

To install the Android cross compiler and set up the environment:

For Advanced Users

Android NDK will be installed in /opt/android-sdk-linux. If you don't want to install it on your host, use our LEIP Optimize docker image.

  1. Download the installation script and run it:

    chmod +x android-setup.sh
    sudo ./android-setup.sh
    

  2. The script will:

    • Install Android SDK tools
    • Install Android NDK
    • Set up necessary environment variables
    • Configure the cross-compiler toolchain
  3. After installation, the following environment variables will be set:

    ANDROID_HOME=/opt/android-sdk-linux
    ANDROID_NDK_HOME=/opt/android-sdk-linux/ndk/21.3.6528147/
    LEIP_NDK_CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android29-clang++
    

Note

You can customize the installation by passing different versions as arguments to the script:

sudo ./android-setup.sh <ndk_version> <cmake_version> <build_tools_version> <android_platform>

Troubleshooting

The above scripts will try to handle most of the environment setup but won't be able to account for all dependencies. Below are a list of software requirements.

  • GLIBCXX_3.4.30: When Jupyter notebook is installed, you'll have GLIBCXX_3.4.29.

    Solution: conda upgrade -c conda-forge libstdcxx-ng

  • g++-aarch64-linux-gnu: The cross-compiler for ARM chips cannot be installed via conda.

    Solution: sudo apt-get update && sudo apt-get install -y g++-aarch64-linux-gnu