Rasmus Lindqvist

07/05/2023, 1:34 PM
Hi all, I am trying to run an agent through a docker container, but get an import error when using the
image. (More context in thread). Does anyone have a template for a Dockerfile to run a agent? Tried googling but have not found any examples.
This is what the Dockerfile looks like:
Copy code
FROM prefecthq/prefect:latest-python3.8
CMD prefect cloud login -k ${PREFECT_KEY} && prefect agent start -q main
And this is the error:
Copy code
Traceback (most recent call last):
  File "/usr/local/bin/prefect", line 5, in <module>
    from prefect.cli import app
  File "/usr/local/lib/python3.8/site-packages/prefect/", line 37, in <module>
    from prefect.states import State
  File "/usr/local/lib/python3.8/site-packages/prefect/", line 14, in <module>
    from prefect.client.schemas import State as State
  File "/usr/local/lib/python3.8/site-packages/prefect/client/schemas/", line 4, in <module>
    from .actions import BlockTypeUpdate, StateCreate
  File "/usr/local/lib/python3.8/site-packages/prefect/client/schemas/", line 7, in <module>
    from pydantic import Field, root_validator, validator
  File "/usr/local/lib/python3.8/site-packages/pydantic/", line 13, in <module>
    from . import dataclasses
  File "/usr/local/lib/python3.8/site-packages/pydantic/", line 11, in <module>
    from ._internal import _config, _decorators, _typing_extra
  File "/usr/local/lib/python3.8/site-packages/pydantic/_internal/", line 9, in <module>
    from ..config import ConfigDict, ExtraValues, JsonSchemaExtraCallable
  File "/usr/local/lib/python3.8/site-packages/pydantic/", line 10, in <module>
    from .deprecated.config import BaseConfig
  File "/usr/local/lib/python3.8/site-packages/pydantic/deprecated/", line 6, in <module>
    from typing_extensions import deprecated
ImportError: cannot import name 'deprecated' from 'typing_extensions' (/usr/local/lib/python3.8/site-packages/
Solved it by using a python:3.8 image and installing prefect into it instead