<@ULVA73B9P> why do i have to do this on ECS `EXT...
# ask-marvin
m
@Marvin why do i have to do this on ECS
EXTRA_PIP_PACKAGES: "prefect-aws==0.4.14 s3fs==2024.10.0 prefect==3.1.2"
the image should have aws already installed no? what am i missing here
m
You're right in noting that you need to specify
EXTRA_PIP_PACKAGES
, even though it might seem that these should already be included in the base image. This requirement arises because the Prefect base images are often minimal and do not include all possible dependencies for all features or integrations. This keeps the image lightweight and allows users to customize based on their needs. There are certain extras, like
prefect-aws
,
s3fs
, and others, that are not bundled into the image to avoid bloating it with packages that not everyone might need. This approach ensures flexibility and provides users with the ability to select only the packages necessary for their specific use cases. In your scenario running on ECS, specifying
EXTRA_PIP_PACKAGES
ensures that these additional dependencies are installed, so everything works smoothly with AWS-related tasks and storage. Looks like you already stumbled upon this while deploying flows on AWS ECS. If you ever feel like the runtime environment judges you for needing these extras, just remember, all packages are equal... except some are more equal than others. Here's a related GitHub issue discussing missing extras in base images that might interest you.
m
@Marvin so none of the extras are in the image?
m
Exactly, none of the extras are included in the Prefect base images by default. This design choice aims to keep the images slim and to let users add only what they specifically require through
EXTRA_PIP_PACKAGES
. This way, you don't carry unnecessary baggage around—just the essentials for your journey! Feel free to install as many extras as you need by listing them in
EXTRA_PIP_PACKAGES
when configuring your Prefect environment on ECS or elsewhere. If you'd like more details, here's a related discussion on GitHub.
m
@Marvin is there a bloated image with those extras already?
m
Unfortunately, it appears there isn't an official Prefect image with all extras included by default. The typical approach is to start with a minimal base image and then install only the packages you need using
EXTRA_PIP_PACKAGES
, which helps maintain flexibility and keeps the image lightweight. There used to be an effort to include some core orchestration dependencies directly in the standard Prefect image, as well documented in this GitHub pull request, but a comprehensive "all_extras" Docker image was removed. So, while you're out there battling dependency woes, just remember: no one wants to haul around a suitcase full of every extra, just the ones for THIS trip!
m
@Marvin i am getting this error with the prefect-aws extra
Copy code
Warning! Failed to load collection 'prefect_aws': PydanticUserError: The `__modify_schema__` method is not supported in Pydantic v2. Use `__get_pydantic_json_schema__` instead in class `SecretStr`.
m
The error you're experiencing is related to changes in how Pydantic version 2 handles schema modifications. Specifically, Prefect is still using
__modify_schema__
, a method that was deprecated in favor of
__get_pydantic_json_schema__
. From the Prefect 2.x and 3.x documentation, there's some guidance around using
SecretStr
to obfuscate sensitive information in logs and UI, evident in both Prefect 2.x and 3.x versions. This page offers insights on managing secret fields in blocks. To resolve the error, you might want to ensure you're using a compatible version of the
prefect-aws
library with Pydantic v2 or explore downgrading Pydantic if feasible. If you're still stumped, it might be worthwhile to check if there's a specific updated version of the
prefect-aws
library that resolves this compatibility issue. Sometimes waiting for a bug-fix release is like waiting for a bus that you're sure will arrive... eventually!
m
@Marvin this is in ECS for the worker
m
There aren't any specific issues currently open in the Prefect GitHub repository about the
PydanticUserError
related to
__modify_schema__
in the context of using
prefect-aws
on ECS. This might mean it's a less common issue or possibly an interaction that's just popping up due to recent updates in Pydantic or Prefect. A good next step would be to check if you're using the latest compatible versions of Prefect and
prefect-aws
. You might also want to reach out on the Prefect community forums or their Slack channel, as there are often discussions around bugs and workarounds before they make it to official issue tracking. Hopefully, this resolves quicker than lining up for a Vogon poetry reading!
m
@Marvin what is the pydantic requirement for the prefect 3.1.2?
m
For Prefect 3.1.2, it appears there is support for Pydantic V2, and the introduction of the Pydantic version 2 brings some changes. One significant change is the way schemas are handled, which impacts integrations that rely on Pydantic for defining and manipulating data models. However, specific details regarding the exact Pydantic version required for Prefect 3.1.2 aren't explicitly documented in the search results. Given the known compatibility with Pydantic V2, using Pydantic version 2.x would be aligned with recent updates. If you need precise version alignment to avoid errors like the one you're facing, it might be best to ensure all dependencies, including Pydantic, are fully updated to their latest stable versions when updating Prefect, or consult Prefect's release notes for any unlisted specifics. Sometimes, dealing with version requirements is like a journey through improbably large data structures, but with less tea.
n
hi @mondras - all prefect 3.x is pydantic >= 2.x and yeah the base images dont come w all extras so for the images you need • worker image: prefect base image + prefect-aws (for the ecs worker) • flow run images: prefect base image + whatever python deps your flow uses
👍 1