proud-answer-87162
09/08/2025, 6:33 PMWebhookTask feature. i have flytekit 1.16.3 installed and my IDE recognizes the import from flytekit.extras.webhook import WebhookTask. however, when i run the workflow with --remote i see this error: Caused by: ModuleNotFoundError: No module named 'flytekit.extras.webhook'ancient-wolf-19325
09/08/2025, 6:33 PMflytekit version (1.16.3) that includes the flytekit.extras.webhook module. While your local environment recognizes the import, the remote Flyte execution environment may be using an older image or one without the necessary extras installed, leading to the ModuleNotFoundError for flytekit.extras.webhook (source).
To resolve this, ensure that the Docker image specified for your workflow execution includes flytekit>=1.16.3 and any required plugins. You can do this by building a custom image with the correct dependencies and specifying it via the --image flag when running or registering your workflow (example). Would you like more detail on how to build and use a custom image for Flyte workflows?
Sources:
- https://github.com/flyteorg/flyte/issues/3687
- example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.proud-answer-87162
09/08/2025, 6:59 PM@task(container_image="<http://ghcr.io/flyteorg/flytekit:py3.12-latest|ghcr.io/flyteorg/flytekit:py3.12-latest>") . after a small configuration change, i'm now seeing this related exception:
Trace:
Traceback (most recent call last):
File "/root/workflows/ingestionwf.py", line 52, in get_pipeline_config
from workflows.test import notification_task
File "/root/workflows/test.py", line 3, in <module>
from flytekit.extras.webhook import WebhookTask
File "/usr/local/lib/python3.12/site-packages/flytekit/extras/webhook/__init__.py", line 1, in <module>
from .connector import WebhookConnector
File "/usr/local/lib/python3.12/site-packages/flytekit/extras/webhook/connector.py", line 3, in <module>
import httpx
ModuleNotFoundError: No module named 'httpx'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/flytekit/core/base_task.py", line 767, in dispatch_execute
native_outputs = self.execute(**native_inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/flytekit/core/python_function_task.py", line 214, in execute
return self._task_function(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/shared/errors.py", line 106, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workflows/ingestionwf.py", line 56, in get_pipeline_config
raise ServiceError(
shared.errors.ServiceError: localerror
[Caused by: ModuleNotFoundError: No module named 'httpx']ancient-wolf-19325
09/08/2025, 6:59 PMWebhookTask feature requires the httpx library, which is not included in the default Flytekit image (ghcr.io/flyteorg/flytekit:py3.12-latest). The image contains Flytekit and its core dependencies, but optional dependencies like httpx (needed for flytekit.extras.webhook) must be installed separately (source).
To fix this, you need to build a custom Docker image based on ghcr.io/flyteorg/flytekit:py3.12-latest and add httpx (e.g., via pip install httpx). Then, use this custom image for your task. Would you like detailed steps or a sample Dockerfile for this process?
Sources:
- https://github.com/flyteorg/flyte/blob/master/docs/user_guide/customizing_dependencies/imagespec.md
- https://github.com/flyteorg/flyte/blob/master/docs/user_guide/customizing_dependencies/index.md π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.proud-answer-87162
09/08/2025, 7:14 PMhttpx dependency in the default container?ancient-wolf-19325
09/08/2025, 7:14 PMhttpx to a task via an annotation alone when using the default Flytekit container image. Instead, Flyte recommends specifying dependencies using an ImageSpec in your code, which builds a new image with the required packages (source). There is no supported annotation or decorator parameter that injects Python packages into the default image at runtime.
Hereβs an example using `ImageSpec`:
from flytekit import ImageSpec, task
custom_image = ImageSpec(
registry="ghcr.io/flyteorg",
packages=["httpx"]
)
@task(container_image=custom_image)
def my_task():
import httpx
# your code here
Would you like more detail on how to use ImageSpec or build custom images?
Sources:
- https://github.com/flyteorg/flytekit/blob/master/flytekit/core/task.py
- https://github.com/flyteorg/flyte/blob/master/docs/user_guide/customizing_dependencies/multiple_images_in_a_workflow.md π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.