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:
- Install pip.
- Install Docker.
- Install the LEAN CLI with pip.
$ pip install lean
lean
command available in the terminal. - If you use Linux, you may need to install
tkinter
$ sudo apt-get install python3-tk
- 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:
- The .lean directory in your user's home directory.
- Your CLI root directory.