Skip to content

Installation

Prefect requires Python 3.7 or later.

PyPI

We recommend installing Prefect using a Python virtual environment manager such as pipenv, conda, or virtualenv/venv.

Upgrading from Prefect 1 to Prefect 2

If you're upgrading from Prefect 1 to Prefect 2, we recommend creating a new environment. Should you encounter any issues when upgrading, this ensures being able to roll back to a known working state easily.

Windows and Linux requirements

See Windows installation notes and Linux installation notes for details on additional installation requirements and considerations.

Install Prefect

The following sections describe how to install Prefect in your development or execution environment.

Installing the latest version

Prefect is published as a Python package. To install the latest Prefect release, run the following in a shell or terminal session:

pip install -U prefect

To install a specific version, specify the version, such as:

pip install -U "prefect==2.10.4"

Find the available release versions in the Prefect Release Notes or the PyPI release history.

Installing the bleeding edge

If you'd like to test with the most up-to-date code, you can install directly off the main branch on GitHub:

pip install -U git+https://github.com/PrefectHQ/prefect

The main branch may not be stable

Please be aware that this method installs unreleased code and may not be stable.

Installing for development

If you'd like to install a version of Prefect for development:

  1. Clone the Prefect repository.
  2. Install an editable version of the Python package with pip install -e.
  3. Install pre-commit hooks.
$ git clone https://github.com/PrefectHQ/prefect.git
$ cd prefect
$ pip install -e ".[dev]"
$ pre-commit install

See our Contributing guide for more details about standards and practices for contributing to Prefect.

Checking your installation

To check that Prefect was installed correctly, use the Prefect CLI command prefect version. Running this command should print version and environment details to your console.

$ prefect version
Version:             2.10.4
API version:         0.8.4
Python version:      3.9.16
Git commit:          b6d0433a
Built:               Thu, Apr 13, 2023 5:34 PM
OS/Arch:             darwin/arm64
Profile:             default
Server type:         cloud

Windows installation notes

Prefect supports running Prefect flows on Windows.

Prefect on Windows requires Python 3.8 or later

Make sure to use Python 3.8 or higher when running a Prefect agent on Windows.

You can install and run Prefect as described above via Windows PowerShell, the Windows Command Prompt, or conda. Note that, after installation, you may need to manually add the Python local packages Scripts folder to your Path environment variable.

The Scripts folder path looks something like this (the username and Python version may be different on your system):

C:\Users\Terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts

Watch the pip install installation output messages for the Scripts folder path on your system.

If using Windows Subsystem for Linux (WSL), see Linux installation notes.

Linux installation notes

Currently, Prefect requires SQLite 3.24 or newer.

When installing Prefect and using a SQLite backend on Linux, make sure your environment is using a compatible SQLite version. Some versions of Linux package a version of SQLite that cannot be used with Prefect.

Known compatible releases include:

  • Ubuntu 22.04 LTS
  • Ubuntu 20.04 LTS

You can also:

Using Self-Signed SSL Certificates

If you're using a self-signed SSL certificate, you need to configure your environment to trust the certificate. This is usually done by adding the certificate to your system bundle and pointing your tools to use that bundle by configuring the SSL_CERT_FILE environment variable.

If the certificate is not part of your system bundle you can set the PREFECT_API_TLS_INSECURE_SKIP_VERIFY to True to disable certificate verification altogether.

Note: This is not secure and so is recommended only for testing!

Proxies

Prefect supports communicating via proxies through environment variables. Simply set HTTPS_PROXY and SSL_CERT_FILE in your environment, and the underlying network libraries will route Prefect’s requests appropriately. You can read more about this in the article Using Prefect Cloud with proxies.

External requirements

While Prefect works with many of your favorite tools and Python modules, it has a few external dependencies.

SQLite

Prefect server uses SQLite as the default backing database, but it is not packaged with the Prefect installation. Most systems will have SQLite installed already since it is typically bundled as a part of Python. Prefect requires SQLite version 3.24.0 or later.

You can check your SQLite version by executing the following command in a terminal:

$ sqlite3 --version

Or use the Prefect CLI command prefect version, which prints version and environment details to your console, including the server database and version. For example: Or use the Prefect CLI command prefect version, which prints version and environment details to your console, including the server database and version. For example:

$ prefect version
Version:             2.10.4
API version:         0.8.4
Python version:      3.9.16
Git commit:          b6d0433a
Built:               Thu, Apr 13, 2023 5:34 PM
OS/Arch:             darwin/arm64
Profile:              default
Server type:         cloud

Install SQLite on RHEL

The following steps are needed to install an appropriate version of SQLite on Red Hat Enterprise Linux (RHEL).

Note that some RHEL instances have no C compiler, so you may need to check for and install gcc first:

yum install gcc

Download and extract the tarball for SQLite.

wget https://www.sqlite.org/2022/sqlite-autoconf-3390200.tar.gz
tar -xzf sqlite-autoconf-3390200.tar.gz

Change to the extracted SQLite folder, then build and install SQLite.

cd sqlite-autoconf-3390200/
./configure
make
make install

Add LD_LIBRARY_PATH to your profile.

echo 'export LD_LIBRARY_PATH="/usr/local/lib"' >> /etc/profile

Restart your shell to register these changes.

Now you can install Prefect using pip.

pip3 install prefect

Using Prefect in an environment with HTTP proxies

If you are using Prefect Cloud or hosting your own Prefect server instance, the Prefect library will connect to the API via any proxies you have listed in the HTTP_PROXY, HTTPS_PROXY, or ALL_PROXY environment variables. You may also use the NO_PROXY environment variable to specify which hosts should not be sent through the proxy.

For more information about these environment variables, see the cURL documentation.

Resetting the database deletes data

Note that resetting the database causes the loss of any existing data.