# Installing Prefect

# Requirements

Prefect requires Python 3.6+. If you're new to Python, we recommend installing the Anaconda distribution.

# Installation

To install Prefect, run:

pip install prefect

or, if you prefer to use conda:

conda install -c conda-forge prefect

or pipenv:

pipenv install --pre prefect

# Optional dependencies

Prefect ships with a number of optional dependencies, which can be installed using "extras" syntax:

pip install "prefect[extra_1, extra_2]"

Examples of extra packages include:

  • all_extras: includes all of the optional dependencies
  • dev: tools for developing Prefect itself
  • templates: tools for working with string templates
  • viz: tools for visualizing Prefect flows
  • aws: tools for interacting with Amazon Web Services
  • azure: tools for interacting with Microsoft Azure
  • google: tools for interacting with Google Cloud Platform
  • kubernetes: tools for interacting with Kubernetes API objects
  • twitter: tools for interacting with the Twitter API
  • airtable: tools for interacting with the Airtable API
  • spacy: tools for building NLP pipelines using Spacy
  • redis: tools for interacting with a Redis database

Python 3.9

Prefect support for Python 3.9 is experimental and extras are not expected to work yet as we wait for required packages to be updated.

# Running the local server and UI

Prefect includes an open-source server and UI for orchestrating and managing flows. The local server stores flow metadata in a Postgres database and exposes a GraphQL API. The local server requires Docker and Docker Compose to be installed. If you have Docker Desktop on your machine, you've got both of these. Prefect Server also has an experimental helm chart for larger deployments to Kubernetes.

Prefect Cloud

Once you are ready to deploy into production, you can use Prefect Cloud to orchestrate your workflows.

Before running the server for the first time, run:

prefect backend server

This configures Prefect for local orchestration, and saves the configuration in your local ~/.prefect directory.

Next, to start the server, UI, and all required infrastructure, run:

prefect server start

Once all components are running, you can view the UI by opening a browser and visiting http://localhost:8080.

Please note that executing flows from the server requires at least one Prefect Agent to be running: prefect agent local start.

Finally, to register any flow with the server, call flow.register(). For more detail, please see the orchestration docs.