# Have no timezone keys for ZoneInfo on Windows 11 installation

**URL:** <https://discuss.python.org/t/have-no-timezone-keys-for-zoneinfo-on-windows-11-installation/43083>\
**Category:** Python Help\
**Created:** [January 13, 2024, 2:12am UTC](https://discuss.python.org/t/have-no-timezone-keys-for-zoneinfo-on-windows-11-installation/43083 "2024-01-13T02:12:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nc3man](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/nc3man/32/17152_2.png) [@nc3man](https://discuss.python.org/u/nc3man)\
**Post date:** [January 13, 2024, 2:12am UTC](https://discuss.python.org/t/have-no-timezone-keys-for-zoneinfo-on-windows-11-installation/43083/1 "2024-01-13T02:12:31Z")

</div>

I’m trying to migrate from pytz to zoneinfo as pytz fades into the sunset. I am running python 3.11.0 and also installed a fresh 3.12.1 (both via [Python Releases for Windows | Python.org](https://www.python.org/downloads/windows/)) to see if it solved my problem. I am simply trying to run the simple example:

```auto
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))

```

Both python versions error with

```auto
File "C:\Users\karl\AppData\Local\Programs\Python\Python312\Lib\zoneinfo\_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key America/Los_Angeles'

```

Note that I can use zoneinfo without issue on linux with python 3.9 and on win 11 in a pyzo shell also using python 3.9 (anaconda flavor). Does something needed to be added for 3.11+ beyond the standard install? I googled around and saw something about TZPATH but I don’t see directories named with timezone keys.

This must be a simple configuration missing.

---

<div class="post-metadata">

**Author:** ![nc3man](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/nc3man/32/17152_2.png) [@nc3man](https://discuss.python.org/u/nc3man)\
**Post date:** [January 13, 2024, 6:25am UTC](https://discuss.python.org/t/have-no-timezone-keys-for-zoneinfo-on-windows-11-installation/43083/2 "2024-01-13T06:25:35Z")

</div>

For my Anaconda installation, I have a folder `C:\Users\karl\anaconda3\share\zoneinfo` that contains files and directories which match the timezone keys I want to use like America/Los\_Angeles, America/New\_York, etc. I tried setting a TZPATH env variable to `C:\Users\karl\anaconda3\share\zoneinfo` but this didn’t solve the problem. But it does explain why my pyzo/anaconda 3.9 environment has a working zoneinfo.

---

<div class="post-metadata">

**Author:** ![petersuter](https://avatars.discourse-cdn.com/v4/letter/p/13edae/32.png) [@petersuter](https://discuss.python.org/u/petersuter)\
**Post date:** [January 13, 2024, 7:30am UTC](https://discuss.python.org/t/have-no-timezone-keys-for-zoneinfo-on-windows-11-installation/43083/3 "2024-01-13T07:30:46Z")

</div>

From the [zoneinfo docs](https://docs.python.org/3/library/zoneinfo.html):

> By default, [`zoneinfo`](https://docs.python.org/3/library/zoneinfo.html#module-zoneinfo) uses the system’s time zone data if available; if no system time zone data is available, the library will fall back to using the first-party [tzdata](https://pypi.org/project/tzdata/) package available on PyPI.
> 
> First-party package maintained by the CPython core developers to supply time zone data via PyPI.
> 
> ## Data sources
> 
> The `zoneinfo` module does not directly provide time zone data, and instead pulls time zone information from the system time zone database or the first-party PyPI package [tzdata](https://pypi.org/project/tzdata/), if available. Some systems, including notably Windows systems, do not have an IANA database available, and so for projects targeting cross-platform compatibility that require time zone data, it is recommended to declare a dependency on tzdata. If neither system data nor tzdata are available, all calls to [`ZoneInfo`](https://docs.python.org/3/library/zoneinfo.html#zoneinfo.ZoneInfo) will raise [`ZoneInfoNotFoundError`](https://docs.python.org/3/library/zoneinfo.html#zoneinfo.ZoneInfoNotFoundError).

So you probably want to install tzdata e.g. via pip or whatever dependency system you use.

---

<div class="post-metadata">

**Author:** ![nc3man](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/nc3man/32/17152_2.png) [@nc3man](https://discuss.python.org/u/nc3man)\
**Post date:** [January 13, 2024, 2:52pm UTC](https://discuss.python.org/t/have-no-timezone-keys-for-zoneinfo-on-windows-11-installation/43083/4 "2024-01-13T14:52:31Z")

</div>

Thank you so much. That was too easy 😉. Sorry I missed that in the docs. Interesting that the windows installer doesn’t add a pip install tzdata if the intent is to make pytz fully obsolete. Obviously, my python 3.9 installs include tzdata.

> [@nc3man](#):
>
> `dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))`
