Is anyone else running into an error (`RuntimeErro...
# ask-community
g
Is anyone else running into an error (
RuntimeError: Unable to find any timezone configuration
) with prefect==2.14.5 when just trying to import from prefect (e.g.
from prefect import task
)? @Prefect is this expected behavior?
Note: this can be resolved with setting the
TZ
env var (e.g.
TZ=UTC
), but an import triggering a runtime error isn't ideal
a
woof, that's not great. I did this wish a fresh venv on my end and couldn't reproduce. Can you tell me more about your setup / machine?
g
We're running flows in our own custom containers. Here's a Dockerfile that should recreate the error if you build and run:
Copy code
FROM ubuntu:22.04

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        python3 \
        python3-pip && \
    apt-get autoremove -y && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN pip install prefect==2.14.5

CMD ["/usr/bin/python3", "-c", "from prefect import task"]
@Alexander Azzam any luck reproducing? Here's the full stacktrace that the image produces:
Copy code
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/prefect/__init__.py", line 37, in <module>
    from prefect.runner import Runner, serve
  File "/usr/local/lib/python3.10/dist-packages/prefect/runner/__init__.py", line 1, in <module>
    from .runner import Runner, serve
  File "/usr/local/lib/python3.10/dist-packages/prefect/runner/runner.py", line 59, in <module>
    from prefect.client.orchestration import get_client
  File "/usr/local/lib/python3.10/dist-packages/prefect/client/orchestration.py", line 32, in <module>
    import prefect.settings
  File "/usr/local/lib/python3.10/dist-packages/prefect/settings.py", line 658, in <module>
    PREFECT_CLOUD_URL = Setting(
  File "/usr/local/lib/python3.10/dist-packages/prefect/settings.py", line 143, in __init__
    generate_deprecation_message(
  File "/usr/local/lib/python3.10/dist-packages/prefect/_internal/compatibility/deprecated.py", line 69, in generate_deprecation_message
    parsed_start_date = pendulum.from_format(start_date, DEPRECATED_DATEFMT)
  File "/usr/local/lib/python3.10/dist-packages/pendulum/__init__.py", line 259, in from_format
    parts = _formatter.parse(string, fmt, now(), locale=locale)
  File "/usr/local/lib/python3.10/dist-packages/pendulum/__init__.py", line 211, in now
    dt = _datetime.datetime.now(local_timezone())
  File "/usr/local/lib/python3.10/dist-packages/pendulum/tz/__init__.py", line 60, in local_timezone
    return get_local_timezone()
  File "/usr/local/lib/python3.10/dist-packages/pendulum/tz/local_timezone.py", line 35, in get_local_timezone
    tz = _get_system_timezone()
  File "/usr/local/lib/python3.10/dist-packages/pendulum/tz/local_timezone.py", line 63, in _get_system_timezone
    return _get_unix_timezone()
  File "/usr/local/lib/python3.10/dist-packages/pendulum/tz/local_timezone.py", line 242, in _get_unix_timezone
    raise RuntimeError("Unable to find any timezone configuration")
RuntimeError: Unable to find any timezone configuration