NAV Navbar

CLI Overview

###########################################################
# Windows specific command prompt instructions shown here #
###########################################################
#########################################################
# macOS specific command prompt instructions shown here #
#########################################################

The Bonsai Command Line Interface (CLI) is a text-based tool that enables you to configure and control the Bonsai Artificial Intelligence Engine. The CLI is especially useful for automation and connection to other tools. Currently, there are some actions that can only be performed using the CLI, such as editing a BRAIN’s project file and getting predictions from a BRAIN.

This guide will walk you through any prerequisites you may need, and how to install the Bonsai CLI. The reference document for all of the commands you will see in this guide can be found in the CLI Reference.

Install Prerequisites

Before you begin, you will need to have access to the Bonsai Platform preview. If you don’t have access yet, request access at bons.ai.

The next section walks you through how to install Git, Python, and pip, but if you’re already ahead of the curve and have them all installed, skip down to Install the Bonsai CLI.

There are three sets of install instructions, please pick the one that suits your situation:

  1. If you have Anaconda installed on your system, skip down to Install with Anaconda.
  2. If you have Chocolatey (Windows) or Homebrew (macOS) installed on your system, skip down to Install with Chocolatey or Homebrew.
  3. If you do not have Chocolatey, Homebrew, or Anaconda installed on your system continue to follow our Manual Install intructions below.

Manual Install

Windows

  • pip: Python version 2.7.9 and greater come with pip, but if for some reason you need to use a different version of Python please follow these instructions.

Great! Now that you have Git, Python, and pip installed, you can skip down to Install the Bonsai CLI.

macOS

  • Git: Git is more than likely already installed on your computer if you have Xcode, but if not, run git from your command prompt and the system will prompt you to install.
  • Python: Download and install Python (3.6 or 2.7) from python.org.
  • pip: Python version 2.7.9 and greater come with pip (or pip3 for version 3+), but if for some reason you need to use a different version of Python please follow these instructions.

Great! Now that you have Git, Python, and pip installed, you can skip down to Install the Bonsai CLI.

Install with Chocolatey or Homebrew

If you do not have Chocolatey or Homebrew installed on your system, please go to the Manual Install or Install with Anaconda instructions.

Python 2

choco install git
choco install python2
brew install python

Python 3

choco install git
choco install python
brew install python3

Windows

If you’re already familiar with Chocolatey, follow these instructions.

macOS

If you’re already familiar with Homebrew, follow these instructions.

  • Git: Git is more than likely already installed on your computer if you have Xcode, but if not, run git from your command prompt and the system will prompt you to install.
  • Python: Run the install command on the tab to the right to brew install the Python version of your choice.

Install with Anaconda

conda install git

If you do not have Anaconda installed on your system, please go to the Manual Install or Install with Chocolatey or Homebrew instructions.

conda is a tool for installing and managing Python and R dependencies. Anaconda includes Python and pip, so all you need to do is install Git if you haven’t already. For more information, refer to the Anaconda website.

Install the Bonsai CLI

Python 2 and Anaconda

pip install bonsai-cli
bonsai configure # for authentication

Python 3

# same as above
pip3 install bonsai-cli
bonsai configure # for authentication

From your command prompt, install the Bonsai Command Line Interface tool and configure (authenticate) it. bonsai configure will ask for your Access Key. You can find your Access Key in your Bonsai Account Settings.

Next Steps

Now that you’ve installed the Bonsai CLI you can follow the local development guide Run the Platform Locally to get started with the Bonsai Platform.

If you have already trained a BRAIN on the web and are looking to use the Bonsai CLI to get predictions from your BRAIN you can either follow the instructions on the web to connect your local environment to your BRAIN or see Predict with Your BRAIN for an example.