Platform Installation
The next step after ensuring NVIDIA Drivers and Enviornment are stable and compatible
With the virtual machine established and optimised, we will now establish the virtual environment for Axolotl
Download the axolotl library
git clone https://github.com/OpenAccess-AI-Collective/axolotl.git
Then navigate into the library:
cd axolotl
Virtual Environment
Check for Anaconda:
Ensure Anaconda is installed and create and Anaconda environment called 'axolotl'
Type the following command into the terminal to check if Anaconda is installed and press Enter:
conda --version
If Anaconda is installed, this command will return the version number:
conda 23.10.0
If you get an error or message saying that
conda
is not recognised, it means Anaconda is not installed.
If Anaconda is not installed - follow the installation instructions below "Installing Miniconda":
Create Environment
Axolotl requires Pytorch >=3.9 and Pytorch >=2.0
We are going to use Python 3.10 - which is a compromise between the latest Python and the minimum Python environment required
In this case, we want to create a conda environment with a specific version of Python, so do not use the
conda create --clone
command to create a clone of thebase
environment.
Use the following command to create an environment named 'axolotl' the contains the base libraries
conda create -n axolotl python=3.10
Once the environment has been created, activate the environment:
conda activate axolotl
To ensure that there are no installed packages in the environment, enter the command:
pip3 freeze
To ensure we only download fresh copies of packages and do not use packages in the cache, enter this command.
pip3 cache purge
Because the environment may be empty; we need to install lit and cmake to install from wheels.
The purpose of running pip install lit cmake
is to set up a development environment with specific tools needed for compiling, building, testing, or packaging software, particularly in projects that might involve C/C++ code or require complex build configurations.
pip3 install lit cmake
The output should be similar to this:
Successfully installed cmake-3.29.2 lit-18.1.3
The Python Interpreter
Remember, when using Visual Studio Code with virtual environments, make sure that you ensure that you have set the Python Interpreter to your virtual environment
Access the Command Palette
Open VS Code, and from the menu, go to View > Command Palette, or use the keyboard shortcut Ctrl+Shift+P.

The Python: Select Interpreter command displays a list of available global environments, conda environments, and virtual environments.
The following image, for example, shows several Anaconda installations along with a conda environment and a virtual environment (env
) that's located within the workspace folder:
Open VS Code, and from the menu, go to View > Command Palette, or use the keyboard shortcut Ctrl+Shift+P.
In the Command Palette, type "Python: Select Interpreter" and select this command when it appears in the list.

Make sure you select the axolotl virtual environment we have created.
Pytorch Installation
--> The environment should contain Pytorch 2.0
Go to the Pytorch website and select your variables - version, operating system, package (Conda), Language, Computer Platform. It will provide you the command to run in your activated Conda environment.
https://pytorch.org/get-started/locally/

Then take the output provided and go into your terminal and enter the command. Ensure that you are within the conda environment 'axolotl' (conda activate axolotl) if you are not enter the command:
conda activate axolotl
The command below is for installation of Pytorch 2.1 on a Linux terminal using Python and CUDA 12.1
conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia
Press (y) when asked to download the libraries suggested/
This is a breakdown of the command:
conda install
: This indicates that you're using Condapytorch
: This is the main PyTorch librarytorchvision
: A package for PyTorch that provides utilities for image and video processingtorchaudio
: A package for PyTorch tailored for audio processingpytorch-cuda=12.1
: This specifies that you want the PyTorch build that is compatible with CUDA 12.1.-c pytorch
: This tells Conda to install from thepytorch
channel on Anaconda Cloud.-c nvidia
: This specifies to also use thenvidia
channel, which is necessary for CUDA-related packages.
Instruction
When the pytorch installation command is executed, the terminal will ask if you want to install all of the Pytorch packages - reply yes.
By following these steps, you should be able to successfully install the Axolotl library on your Ubuntu 20.04 version.
Install "Packaging" Package
Now install the packaging
and ninja python packages.
The packaging
library provides utilities for version handling, specifiers, markers, requirements, tags, and more, which are often used in package management and installation.
install ninja
Run the Axolotl setup.py file
Ensure that you are in the base directory that contains the
setup.py
file.Run the installation command:
pip3 install -e '.[flash-attn,deepspeed]'
-e
flag
-e
flagStands for "editable" mode. When you install a package in editable mode, Python installs the package in a way that allows you to modify the package source code and see the changes directly without needing to reinstall the package. This is particularly useful for development purposes.
This is important
The
dot "."
represents the current directory. In this context, it indicates that pip
should install the package located in the current directory.
This directory contains the setup.py
file, which is the build script for setuptools. It tells setuptools about your package (such as the name and version) and the files that belong to it.
[flash-attn,deepspeed]
These are extras.
Extras are additional dependencies that are relevant for optional features of the package.
In this case, flash-attn
and deepspeed
are optional dependencies. When you specify these extras, pip
will also install the dependencies associated with these features as defined in the package's setup.py
.
This command will install the Axolotl package along with its dependencies as specified in setup.py
.
Install Logging
We will be using Weights and Biases for training logging.
Weights and Biases should already be installed, if it is not - to install Weights and Biases:
pip3 install wandb
Login to Weights and Biases
wandb login
When asked, complete the following fields for your Weights and Biases account:
Username:
Password:
API Token:
If you are interested in understanding the libraries and processes installed via the setup.py script, please review the following pages.
Last updated
Was this helpful?