Skip to content

Installation

Prefect requires Python 3.8 or newer.

PyPI

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

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 release or upgrade an existing Prefect install, run the following command in your terminal:

pip install -U prefect

To install a specific version, specify the version number like this:

pip install -U "prefect==2.10.4"

See available release versions in the Prefect Release Notes.

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 confirm that Prefect was installed correctly, run the command prefect version to print the version and environment details to your console.

$ prefect version

Version:             2.10.21
API version:         0.8.4
Python version:      3.10.12
Git commit:          da816542
Built:               Thu, Jul 13, 2023 2:05 PM
OS/Arch:             darwin/arm64
Profile:              local
Server type:         ephemeral
Server:
  Database:          sqlite
  SQLite version:    3.42.0

Windows installation notes

You can install and run Prefect via Windows PowerShell, the Windows Command Prompt, or conda. 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\MyUserNameHere\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts

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

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

Linux installation notes

Linux is a popular operating system for running Prefect. You can use Prefect Cloud as your API server, or host your own Prefect server backed by PostgreSQL.

For development, you can use SQLite 2.24 or newer as your database. Note that certain Linux versions of SQLite can be problematic. Compatible versions include Ubuntu 22.04 LTS and Ubuntu 20.04 LTS.

Alternatively, you can install SQLite on Red Hat Enterprise Linux (RHEL) or use the conda virtual environment manager and configure a compatible SQLite version.

Using a self-signed SSL certificate

If you're using a self-signed SSL certificate, you need to configure your environment to trust the certificate. You can add 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: Disabling certificate validation is insecure and only suggested as an option 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. Read more about using Prefect Cloud with proxies here.

External requirements

SQLite

You can use Prefect Cloud as your API server, or host your own Prefect server backed by PostgreSQL.

By default, a local Prefect server instance uses SQLite as the backing database. SQLite is not packaged with the Prefect installation. Most systems will already have SQLite installed, because 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:

$ prefect version
Version:             2.10.21
API version:         0.8.4
Python version:      3.10.12
Git commit:          a46cbebb
Built:               Sat, Jul 15, 2023 7:59 AM
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

Move to the extracted SQLite directory, 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.

Next steps

Now that you have Prefect installed and your environment configured, you may want to check out the Tutorial to get more familiar with Prefect.