You can install Zipline either using pip, the Python package installer, or conda, the package and environment management system that runs on Windows, macOS, and Linux. In case you are installing zipline-reloaded alongside other packages and encounter [conflict errors](https://github.com/conda/conda/issues/9707), consider using [mamba](https://github.com/mamba-org/mamba) instead.
Zipline runs on Python 3.7, 3.8 and 3.9. To install and use different Python versions in parallel as well as create a virtual environment, you may want to use pyenv.
Installing Zipline via
pip is slightly more involved than the average Python package.
There are two reasons for the additional complexity:
Zipline ships several C extensions that require access to the CPython C API. In order to build these C extensions,
pipneeds access to the CPython header files for your Python installation.
Because LAPACK and the CPython headers are non-Python dependencies, the correct way to install them varies from platform to platform. If you’d rather use a single tool to install Python and non-Python dependencies, or if you’re already using Anaconda as your Python distribution, you can skip to the :ref: conda section.
Once you’ve installed the necessary additional dependencies (see below for your particular platform), you should be able to simply run (preferably inside an activated virtual environment):
$ pip install zipline-reloaded
On Debian-derived Linux distributions, you can acquire all the necessary
binary dependencies from
apt by running:
$ sudo apt install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev hdf5-tools
On recent RHEL-derived derived Linux distributions (e.g. Fedora), the following should be sufficient to acquire the necessary additional dependencies:
$ sudo dnf install atlas-devel gcc-c++ gcc-gfortran libgfortran python-devel redhat-rpm-config hdf5
On Arch Linux, you can acquire the additional dependencies via
$ pacman -S lapack gcc gcc-fortran pkg-config hdf5
There are also AUR packages available for installing ta-lib. Python 3 is also installable via:
$ pacman -S python3
You will also need to compile the TA-Lib library for technical analysis so its headers become available.
You can accomplish this as follows:
$ wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz $ tar -xzf ta-lib-0.4.0-src.tar.gz $ cd ta-lib/ $ sudo ./configure $ sudo make $ sudo make install
This will allow you to install the Python wrapper with
pip as expected by the binary wheel.
The version of Python shipped with macOS is generally out of date, and has a number of quirks because it’s used directly by the operating system. For these reasons, many developers choose to install and use a separate Python installation.
Assuming you’ve installed Python with
brew, you’ll also likely need the
$ brew install freetype pkg-config gcc openssl hdf5 ta-lib
For Windows, the easiest and best supported way to install Zipline is to use
Another way to install Zipline is via the
conda package manager, which
comes as part of the Anaconda distribution. Alternatively, you can use
the related but more lightweight Miniconda or
The primary advantage of using Conda over
pip is that
understands the complex binary dependencies of packages like
scipy. This means that
conda can install Zipline and its dependencies
without requiring the use of a second tool to acquire Zipline’s non-Python
For instructions on how to install
conda, see the Conda Installation
Unfortunately, as of April 2021,
conda produces numerous false
positive [conflict errors](https://github.com/conda/conda/issues/9707)
while working to identify dependencies. Should this be your experience, consider
[mamba](https://github.com/mamba-org/mamba) instead, which works much faster and
reliably in most cases.
conda has been set up you can install Zipline from the
You’ll also need to activate the conda-forge and ranaroussi channels to source various dependencies.
You can do so either by adding them to your
configuration file, or as command line flags:
conda install -c ml4t -c conda-forge -c ranaroussi zipline-reloaded
It is recommended to install Zipline in an isolated
Installing Zipline in
conda environments will not interfere your default
Python deployment or site-packages, which will prevent any possible conflict
with your global libraries. For more information on
conda environment, see
the Conda User Guide.
conda has been set up, you can create a
$ conda create -n env_zipline python=3.8
Now you have set up an isolated environment called
env_zipline, a sandbox-like
structure to install Zipline. Then you should activate the conda environment
by using the command
$ conda activate env_zipline
You can install Zipline by running
(env_zipline) $ conda install -c ml4t zipline-reloaded
To deactivate the
(env_zipline) $ conda deactivate
conda activate and
conda deactivate only work on conda 4.6 and later versions. For conda versions prior to 4.6, run:
Linux and macOS: