Getting StartedInstallation
Getting Started~ 4 min read

Installation

Python version

Flama supports all currently maintained Python versions, and is distributed as native, per-version wheels for Linux, macOS, and Windows, so there is no Rust toolchain to install. If you do not have any preference, we recommend you to use the latest supported version available.

As a first step, check the version of your active Python environment:

python --version

If the version is prior to the oldest supported version, we suggest you to create a virtual environment with the latest version.

Creating a virtual environment

This section is not a comprehensive guide about the management of Python virtual environments. We encourage you to learn more about venv, pyenv or conda for a better understanding on how to manage virtual environments. Virtual environments allow the isolation of dependencies, which plays a crucial role to avoid breaking compatibility between different projects.

To create and activate a virtual environment with a compatible Python version you can take the following code snippets. Before you start working on a new project, it is very important to activate the corresponding environment. The last command line in both code snippets precisely activate the environment with conda or pyenv, respectively.

Creation of virtual environment with conda
conda create --name flama-dev python=<PYTHON_VERSION> --yesconda activate flama-dev
Creation of virtual environment with pyenv
pyenv install <PYTHON_VERSION>pyenv virtualenv <PYTHON_VERSION> flama-devpyenv local flama-dev

Install Flama

Core

Flama is a Python library hosted on PyPI, and can be easily installed with pip (the package installer for Python). Within the previously created and activated virtual environment, run the following command:

pip install flama

After running this command line, you'll have Flama installed and ready to be used in your project.

Extras

You have installed the core functionality of Flama already. The schema libraries and the generative AI backends are split into optional packages, so you install only what your project needs. The following dependencies are automatically pulled in when you specify the appropriate extra:

  • pydantic to declare schemas with Pydantic, a library for data validation and settings management with support for type hints.

  • typesystem to declare schemas with Typesystem, a library for typed data schemas with validation and (de)serialisation tools.

  • marshmallow to declare schemas with Marshmallow, a library for data validation and (de)serialisation.

  • database to interact with a database through SQLAlchemy, the SQL toolkit and Object Relational Mapper.

  • llm to serve large language models, pulling in the generative AI backends: vLLM on Linux and MLX on Apple Silicon, along with the image and audio decoding dependencies.

  • full to install every extra at once.

An example of installation including pydantic and database would be as follows:

pip install flama[pydantic,database]

To serve generative models, add the llm extra (the appropriate backend for your platform is selected automatically):

pip install flama[llm]

Development

If you want to contribute to Flama development, you will need to install it from the local folder where you have cloned the repository. Run the following command if this is your case:

git clone [email protected]:vortico/flama.gitcd flamamake install

To keep learning you can now check out the Quickstart.

Flama CLI

After installing Flama you will have the Flama command-line interface (CLI) at your disposal. The easiest and more practical way to check that everything was correctly installed is by running:

flama --helpUsage: flama [OPTIONS] COMMAND [ARGS]...
Fire up your models with Flama šŸ”„
Options: --version Check the version of your locally installed Flama --help Get help about how to use Flama CLI
Commands: get Download and package a model as .flm. model Interact with a packaged model without server. run Run a Flama Application based on a route. serve Serve one or more models within a Flama Application. start Start a Flama Application based on a config file. upgrade Upgrade a Flama codebase to a newer major version.

To check what version of the library you have installed, simply run:

flama --version
Flama <VERSION>

If you get something similar to the above output, you are completely set. We recommend you to keep reading the documentation, and enjoy the journey.