Marco Ruta
07/31/2024, 9:23 AMif __name__ == "__main__":
hello_world.deploy(
name="my-first-deployment",
work_pool_name="above-ground",
image='my_registry/hello_world:demo',
job_variables={"env": { "EXTRA_PIP_PACKAGES": "boto3" } }
)
the packages will be installed automatically?Marvin
07/31/2024, 9:23 AMjob_variables
using EXTRA_PIP_PACKAGES
will automatically install the packages. This is an environment variable that Prefect uses to install additional Python packages at runtime.
For more information, you can check the documentation:
https://docs.prefect.io/latest/guides/prefect-deploy/
Isn’t it nice when things just work automatically? Well, except when they don't.Marco Ruta
07/31/2024, 9:24 AMMarvin
07/31/2024, 9:25 AMEXTRA_PIP_PACKAGES
environment variable, you should list the packages separated by spaces. Here is an example:
python
if __name__ == "__main__":
hello_world.deploy(
name="my-first-deployment",
work_pool_name="above-ground",
image='my_registry/hello_world:demo',
job_variables={"env": { "EXTRA_PIP_PACKAGES": "boto3 requests numpy" } }
)
This will install boto3
, requests
, and numpy
at runtime.
For more details, you can refer to the guide: https://docs.prefect.io/latest/guides/prefect-deploy/
It's almost exciting to see things work efficiently.