Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
LadyNamedLaura opened this issue Dec 30, 2021 · 0 comments · Fixed by #122 · May be fixed by #121
Closed

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

LadyNamedLaura opened this issue Dec 30, 2021 · 0 comments · Fixed by #122 · May be fixed by #121
Labels

Comments

@LadyNamedLaura
Copy link

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.

LadyNamedLaura added a commit to LadyNamedLaura/skill-date-time that referenced this issue Dec 30, 2021
@LadyNamedLaura LadyNamedLaura mentioned this issue Dec 30, 2021
5 tasks
@krisgesling krisgesling linked a pull request Mar 22, 2022 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant