<@ULVA73B9P> If I specify extra pip packages like ...
# ask-marvin
m
@Marvin If I specify extra pip packages like this:
Copy code
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" } }
    )
the packages will be installed automatically?
m
Yes, specifying extra pip packages in
job_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.
m
@Marvin what If I want to install more than one? which is the syntax?
m
To install multiple packages using the
EXTRA_PIP_PACKAGES
environment variable, you should list the packages separated by spaces. Here is an example:
Copy code
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.