Skip to main content
Version: Next

Install ALO

Updated 2024.05.05

This page guides you through installing ALO (AI Learning Organizer) from Git to your environment and setting up a virtual environment for running it.

Topics



Set Up Development Environment

To set up the development environment, download ALO into a folder named after your AI Solution.

git clone https://github.com/mellerikat/alo.git {project_name}
./{project_name}/
└ setting # Configuration information required for AI Solution registration
└ example_infra_config # infra_config.yaml configuration samples
└ format_solution_info.yaml # solution_info format entered by the user in register-ai-solution.ipynb (no need to modify)
└ infra_config.yaml
└ sagemaker_config.yaml
└ src # ALO source code
register-ai-solution.ipynb # Jupyter Notebook used for AI Solution registration
main.py # Pipeline run
makefile
README.md
requirements.txt

After installing ALO, you will have the following file and folder structure:

main.py: Executes the entire pipeline of the AI Solution. src: The source code of ALO. register-ai-solution.ipynb: Jupyter Notebook used for AI Solution registration. setting: Folder containing infra_config.yaml, etc., required for AI Solution registration. requirements.txt: List of Python modules that need to be installed for ALO to work.

Since the installation modules may vary depending on the AI Solution, create a new virtual environment (Anaconda, Pyenv, etc.) and install the required Python modules.

conda init bash ## Initialize conda environment
exec bash ## Restart bash
# conda create --prefix /home/jovyan/testenv python=3.10 ## Method to install a non-deletable virtual environment when running jupyter in docker
conda create -n {virtual_env_name} python=3.10 ## 3.10 is required

conda activate {virtual_env_name} ## You can freely choose the virtual environment name
pip install -r requirements.txt
# [Additional steps for registration]
pip install ipykernel
python -m ipykernel install --user --name {virtual_env_name} --display-name {Jupyter Kernel display name}

If using Anaconda is not possible, you can also use virtual environments like Pyenv + Pipenv by following the guide below.

Download the install_pyenv.sh file.

curl -L -o install_pyenv.sh https://raw.githubusercontent.com/mellerikat/alo-guide/main/install_pyenv.sh

If the download does not work, create the install_pyenv.sh file with the following content.

#!/bin/bash
if command -v conda &> /dev/null; then
echo "conda is currently running. Attempting to deactivate..."
conda deactivate
if [ -n "$CONDA_SHLVL" ] && [ "$CONDA_SHLVL" -gt "0" ]; then
echo "Trying to exit from base environment..."
conda deactivate
fi
fi
# Cancel auto init for Anaconda
conda config --set auto_activate_base false
# Install necessary dependencies (for Ubuntu/Debian)

if sudo -n true 2>/dev/null; then
SUDO='sudo'
else
SUDO=''
fi

# List of packages to be installed
PACKAGES="make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev git"

# Execute package update and installation command
$SUDO apt-get update
$SUDO apt-get install -y $PACKAGES

# Install pyenv
if [ ! -d "${HOME}/.pyenv" ]; then
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
else
echo "pyenv is already installed"
fi
# Check and add environment variable settings
BASHRC=~/.bashrc
PYENV_ROOT='export PYENV_ROOT="$HOME/.pyenv"'
PATH_UPDATE='export PATH="$PYENV_ROOT/bin:$PATH:~/.local/bin"'
INIT_COMMAND='eval "$(pyenv init --path)"'
#VIRTUALENV_INIT='eval "$(pyenv virtualenv-init -)"'
# Add PYENV_ROOT
if ! grep -Fxq "$PYENV_ROOT" $BASHRC; then
echo $PYENV_ROOT >> $BASHRC
fi
# Add PATH update
if ! grep -Fxq "$PATH_UPDATE" $BASHRC; then
echo $PATH_UPDATE >> $BASHRC
fi
# Add pyenv init
if ! grep -Fxq "$INIT_COMMAND" $BASHRC; then
echo $INIT_COMMAND >> $BASHRC
fi
# Add pyenv virtualenv-init
if ! grep -Fxq "$VIRTUALENV_INIT" $BASHRC; then
echo $VIRTUALENV_INIT >> $BASHRC
fi
echo "pyenv setup is completed. Please restart your shell or run 'source ~/.bashrc'"


Once the install_pyenv.sh file is ready, proceed with the following steps to create pyenv and pipenv.

## Install pyenv
bash install_pyenv.sh (or ./install_pyenv.sh)
pyenv install 3.10

## Activate pyenv
pyenv global 3.10

## Install pipenv
python3 -m pip install --user pipenv

## Run pipenv
## virtual_env_dir is the folder where the code to be executed in the virtual environment is located. If the folder already exists, you can skip the mkdir command.
## If the folder where the code to be executed already exists, skip the following steps.
mkdir {virtual_env_dir}
cd {virtual_env_dir}
pipenv --python 3.10
pipenv shell

## Delete virtual environment
## If you have already run pipenv shell, proceed in the {virtual_env_dir} folder where the virtual environment is active
pipenv --rm
exit
rm -rf {virtual_env_dir}


Run ALO

Once ALO is installed, you can immediately run ALO using AI Contents that are applicable to various industry domains (Create AI Solution using AI Contents). With just a simple installation process, anyone can do AI modeling. If you want to create a new solution without using AI Contents, you can proceed by referring to Create AI Solution without AI Contents.



Update ALO Version

You can update to the latest version of ALO while maintaining your current AI Solution development environment. Check the latest version of the ALO git and download it using the git checkout command.

git remote show origin
git checkout {new-branch-name}
make clean-history ## Clean up to avoid conflicts with the old version
python main.py