Installation

Installing Lean CLI

Introduction

The Lean CLI is distributed as a Python package, so it requires pip to be installed. See Installing pip to learn how to install pip on your operating system.

The commands which run the LEAN engine locally also depend on Docker being installed and running. See Installing Docker to learn how to install Docker on your operating system.

Install

Follow these steps to install the LEAN CLI:

  1. Install pip.
  2. Install Docker.
  3. Install the LEAN CLI with pip.
    $ pip install lean
    This commands downloads all the CLI's dependencies and makes the lean command available in the terminal.
  4. If you use Linux, you may need to install tkinter
    $ sudo apt-get install python3-tk
  5. Verify the installation was successful.
    $ lean --version

Stay Up-To-Date

We regularly update the CLI to add new features and to fix issues. It is therefore important to keep both the CLI and the Docker images that the CLI uses up-to-date.

Keep the CLI Up-To-Date

Run pip install --upgrade lean to update the CLI to the latest version. The CLI automatically performs a version check once a day and warns you in case you are running an outdated version.

Keep the Docker Images Up-To-Date

Various commands like lean backtest, lean optimize and lean research run the LEAN engine in a Docker container to ensure all the required dependencies are available. When you run these commands for the first time the Docker image containing LEAN and its dependencies is downloaded and stored. Run these commands with the --update flag to update the images they use. Additionally, these commands automatically perform a version check once a week and update the image they use when you are using an outdated Docker image.

Uninstall

Run pip uninstall lean to uninstall the Lean CLI. To perform a full uninstallation, you must also delete configuration files generated by the CLI. These might be found in the following directories:

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: