https://prefect.io logo
Title
t

Tim-Oliver

10/28/2022, 9:16 AM
Hello, I want to run a flow (Prefect 2.x) in a conda environment. Should I activate the environment via the deployment yaml (as described here: https://discourse.prefect.io/t/how-to-run-my-deployment-in-a-virtual-environment-such-as-conda/1423) or should/could I use a Process block for that? What would you recommend?
1
a

Anna Geller

10/28/2022, 10:13 AM
Good question, I'd use a Process block as described there
t

Tim-Oliver

10/28/2022, 10:46 AM
Where?
a

Anna Geller

10/28/2022, 10:48 AM
as described in this Discourse
essentially overwriting the command
t

Tim-Oliver

10/28/2022, 10:51 AM
So editing the deployment yaml and not using a process block? Or does this boil down to the same thing? Because the discourse post I linked edits the deployment yaml file.
a

Anna Geller

10/28/2022, 11:09 AM
yes exactly, this would involve editing the deployment there is actually an easier way: you can activate your conda environment before starting an agent
Process runs everything in the agent process so it would already use your conda env/venv
however, if you need per deployment isolation, I strongly recommend switching to DockerContainer, it makes everything that much easier if building an image is hard, try this https://github.com/anna-geller/prefect-dataplatform/blob/main/deploy_locally_docker.py#L16-L18
t

Tim-Oliver

10/28/2022, 11:51 AM
I would, but I am not allowed to use docker in our environment. And I don't want to start an agent for every possible flow-environment combination. Then I will do as described on discourse. Thanks!
:gratitude-thank-you: 1
🙌 1
👍 1