How to run my deployment in a virtual environment such as conda?

  • Run your agent in the virtual environment you want flows to execute in. Use a separate agent (separate work queue) per virtual environment and agent process if needed.
  • Modify the command that is used for the flow run entrypoint to use Python in the virtual environment:
  command:
  - conda
  - run
  - -n 
  - your_conda_env_name
  - python
  - -m
  - prefect.engine

instead of using the default command running in the same agent process:

  command:
  - python
  - -m
  - prefect.engine
1 Like

The example above is in the deployment YAML file.