Skip to content

ancient version of pytz isn't compatible with modern python versions #120

Closed
@LadyNamedLaura

Description

@LadyNamedLaura

Describe the bug
For some reason, this skill pins a 2017 version of pytz, which doesn't work on recent python versions (I think python3.7+)

To Reproduce
Steps to reproduce the behavior:

  1. install mycroft on python3.10
  2. have the date-time skill automatically installed and pull in pytz==2017.2
  3. notice how stuff like the weather skill break with:
2021-12-30 22:44:28.844 | ERROR    | 562711 | mycroft.skills.skill_loader:_load_skill_source:278 | Failed to load skill: mycroft-weather.mycroftai (ImportError("cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)"))
Traceback (most recent call last):
  File "/home/simon/mycroft-core/.venv/lib/python3.10/site-packages/pytz/lazy.py", line 3, in <module>
    from UserDict import DictMixin
ModuleNotFoundError: No module named 'UserDict'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/simon/mycroft-core/mycroft/skills/skill_loader.py", line 276, in _load_skill_source
    skill_module = load_skill_module(main_file_path, self.skill_id)
  File "/home/simon/mycroft-core/mycroft/skills/skill_loader.py", line 72, in load_skill_module
    spec.loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/mycroft/skills/mycroft-weather.mycroftai/__init__.py", line 33, in <module>
    from .skill import (
  File "/opt/mycroft/skills/mycroft-weather.mycroftai/skill/__init__.py", line 14, in <module>
    from .api import OpenWeatherMapApi
  File "/opt/mycroft/skills/mycroft-weather.mycroftai/skill/api.py", line 26, in <module>
    from .weather import WeatherReport
  File "/opt/mycroft/skills/mycroft-weather.mycroftai/skill/weather.py", line 20, in <module>
    from .util import convert_to_local_datetime
  File "/opt/mycroft/skills/mycroft-weather.mycroftai/skill/util.py", line 18, in <module>
    import pytz
  File "/home/simon/mycroft-core/.venv/lib/python3.10/site-packages/pytz/__init__.py", line 32, in <module>
    from pytz.lazy import LazyDict, LazyList, LazySet
  File "/home/simon/mycroft-core/.venv/lib/python3.10/site-packages/pytz/lazy.py", line 5, in <module>
    from collections import Mapping as DictMixin
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
2021-12-30 22:44:28.863 | ERROR    | 562711 | mycroft.skills.skill_loader:_communicate_load_status:351 | Skill mycroft-weather.mycroftai failed to load

Expected behavior
A mycroft installation that works out of the box

Environment (please complete the following information):

  • Device type: dosktop
  • OS: archlinux
  • Mycroft-core version: 21.2.2
  • Other versions: python 3.10

Additional context
I see no reason to pin a specific version of pytz or at least not update the pin to the latest release whenever a new release of this skill is made. pytz contains timezone data which needs to be up-to-date in order to be correct. (governments all over the world make regular changes to how their timezones work, an up-to-date pytz is needed to reflect those)

Also note: the weird side effect of this is that asking a freshly installed mycroft "what's the weather" will give you wolfram alpha's definition of "the weather", instead of just the weather.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions