Installation#

BentoML is distributed as a Python package available on PyPI. You can install BentoML on Linux/UNIX, Windows, or macOS to get started.

Prerequisites#

Install BentoML#

Install BentoML Python package with pip:

pip install bentoml

To verify your installation:

bentoml --help

Expected output:

Usage: bentoml [OPTIONS] COMMAND [ARGS]...

██████╗ ███████╗███╗   ██╗████████╗ ██████╗ ███╗   ███╗██╗
██╔══██╗██╔════╝████╗  ██║╚══██╔══╝██╔═══██╗████╗ ████║██║
██████╔╝█████╗  ██╔██╗ ██║   ██║   ██║   ██║██╔████╔██║██║
██╔══██╗██╔══╝  ██║╚██╗██║   ██║   ██║   ██║██║╚██╔╝██║██║
██████╔╝███████╗██║ ╚████║   ██║   ╚██████╔╝██║ ╚═╝ ██║███████╗
╚═════╝ ╚══════╝╚═╝  ╚═══╝   ╚═╝    ╚═════╝ ╚═╝     ╚═╝╚══════╝

Options:
-v, --version  Show the version and exit.
-h, --help     Show this message and exit.

Commands:
build               Build a new Bento from current directory.
cloud               BentoCloud Subcommands Groups.
containerize        Containerizes given Bento into an OCI-compliant...
delete              Delete Bento in local bento store.
deploy              Create a deployment on BentoCloud.
deployment          Deployment Subcommands Groups
env                 Print environment info and exit
export              Export a Bento to an external file archive
get                 Print Bento details by providing the bento_tag.
import              Import a previously exported Bento archive file
list                List Bentos in local store
models              Model Subcommands Groups
pull                Pull Bento from a remote Bento store server.
push                Push Bento to a remote Bento store server.
serve (serve-http)  Start a HTTP BentoServer from a given 🍱

Install BentoML from source code#

You can also install BentoML from source code. For example:

pip install git+https://github.com/bentoml/BentoML

This command installs the bleeding edge main branch of BentoML, which is useful for trying the latest unreleased features and bug fixes. However, the main branch may not always be stable. If you run into any issues, please either create an issue or join our community on Slack to get help.

In order to deploy a Bento using the same version of BentoML, either use the Editable install option below, or add the same repo URL to your packages list defined in bentofile.yaml. For example:

python:
    packages:
    - bentoml @ git+https://github.com/bentoml/BentoML.git@main

During bentoml build, the specificed repo will be downloaded, built into a wheel file, and packaged into the Bento created.

Editable install#

Installing BentoML in editable mode is useful when you are contributing to BentoML and testing your code changes in a local copy of the BentoML project. First, clone the repository locally and install BentoML with pip install -e:

git clone https://github.com/bentoml/bentoml.git
cd bentoml
pip install -e .

This command installs BentoML in editable mode, which allows you to test any local code changes immediately by importing the bentoml library again or running a BentoML CLI command. For more information, see the Developer Guide.

Note

In editable mode, Python links this folder and adds it to Python library paths. To keep using the library, you must not move or delete the bentoml folder after installing it in editable mode.

Warning

When running bentoml build using an editable installation of BentoML, a wheel will be built from your local BentoML copy linked with the editable installation, and packaged into the generated Bento. Thus, containers built from this Bento will install the exact same version of BentoML. This feature is meant for helping BentoML contributors to verify their changes, ensuring a consistent behavior across dev, testing and prod environments. If you need to use a custom fork of BentoML for production, make sure to fully test it.