https://prefect.io logo
r

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
prefecthq/prefect:latest-python3.8
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.
1
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/__init__.py", line 37, in <module>
    from prefect.states import State
  File "/usr/local/lib/python3.8/site-packages/prefect/states.py", line 14, in <module>
    from prefect.client.schemas import State as State
  File "/usr/local/lib/python3.8/site-packages/prefect/client/schemas/__init__.py", line 4, in <module>
    from .actions import BlockTypeUpdate, StateCreate
  File "/usr/local/lib/python3.8/site-packages/prefect/client/schemas/actions.py", line 7, in <module>
    from pydantic import Field, root_validator, validator
  File "/usr/local/lib/python3.8/site-packages/pydantic/__init__.py", line 13, in <module>
    from . import dataclasses
  File "/usr/local/lib/python3.8/site-packages/pydantic/dataclasses.py", line 11, in <module>
    from ._internal import _config, _decorators, _typing_extra
  File "/usr/local/lib/python3.8/site-packages/pydantic/_internal/_config.py", line 9, in <module>
    from ..config import ConfigDict, ExtraValues, JsonSchemaExtraCallable
  File "/usr/local/lib/python3.8/site-packages/pydantic/config.py", line 10, in <module>
    from .deprecated.config import BaseConfig
  File "/usr/local/lib/python3.8/site-packages/pydantic/deprecated/config.py", line 6, in <module>
    from typing_extensions import deprecated
ImportError: cannot import name 'deprecated' from 'typing_extensions' (/usr/local/lib/python3.8/site-packages/typing_extensions.py)
Solved it by using a python:3.8 image and installing prefect into it instead
2 Views