Bug 259453 - www/py-flask produces stack trace on run via www/flexget
Summary: www/py-flask produces stack trace on run via www/flexget
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Wen Heping
Depends on:
Reported: 2021-10-26 03:57 UTC by edgeman
Modified: 2021-10-27 00:46 UTC (History)
3 users (show)

See Also:
jbeich: maintainer-feedback+
jbeich: maintainer-feedback? (wen)


Note You need to log in before you can comment on or make changes to this bug.
Description edgeman 2021-10-26 03:57:11 UTC
For a few days now, any time I try to run flexget I get the following:
From reading it, it appears that something wants Jinja2<3.0 whereas my system is installing Jinja2 3.0.1 currently.
Let me know if additional information is needed. I have been keeping my system up to date with portmaster -a every couple days and this would've started a few days ago after an update.

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 568, in _build_master
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 886, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 777, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Jinja2 3.0.1 (/usr/local/lib/python3.8/site-packages), Requirement.parse('Jinja2<3.0,>=2.10.1'), {'flask'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/flexget", line 33, in <module>
    sys.exit(load_entry_point('FlexGet==3.1.145', 'console_scripts', 'flexget')())
  File "/usr/local/bin/flexget", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.8/site-packages/flexget/__init__.py", line 11, in <module>
    from flexget.manager import Manager  # noqa
  File "/usr/local/lib/python3.8/site-packages/flexget/manager.py", line 37, in <module>
    from flexget.config_schema import ConfigError
  File "/usr/local/lib/python3.8/site-packages/flexget/config_schema.py", line 13, in <module>
    from flexget.utils import qualities, template
  File "/usr/local/lib/python3.8/site-packages/flexget/utils/qualities.py", line 8, in <module>
    from flexget.utils.serialization import Serializer
  File "/usr/local/lib/python3.8/site-packages/flexget/utils/serialization.py", line 5, in <module>
    from flexget.utils import json
  File "/usr/local/lib/python3.8/site-packages/flexget/utils/json.py", line 12, in <module>
    from flexget.plugin import DependencyError
  File "/usr/local/lib/python3.8/site-packages/flexget/plugin.py", line 12, in <module>
    import pkg_resources
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3243, in <module>
    def _initialize_master_working_set():
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3226, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3255, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 570, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 583, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 777, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Jinja2 3.0.1 (/usr/local/lib/python3.8/site-packages), Requirement.parse('Jinja2<3.0,>=2.10.1'), {'flask'})
Comment 1 edgeman 2021-10-26 06:42:36 UTC
Updated again tonight, noticed there was another FlexGet update. The above issue is gone now.

I'm now getting a different issue, but I will attempt to resolve that on my own for a bit before I open another bug:

pkg_resources.ContextualVersionConflict: (itsdangerous 2.0.1 (/usr/local/lib/python3.8/site-packages), Requirement.parse('itsdangerous<2.0,>=0.24'), {'flask'})
Comment 2 edgeman 2021-10-26 06:45:58 UTC
.... reopening as this may just be a new, similar issue masking the first one. I can see where portmaster upgraded py-itsdangerous just now to a version that would now be outside of the requirements:

        Upgrade of py38-itsdangerous-0.24 to py38-itsdangerous-2.0.1
        Upgrade of flexget-3.1.145 to flexget-3.1.146
Comment 3 Jan Beich freebsd_committer 2021-10-26 06:51:15 UTC
I can't reproduce either locally (real config) or in 12.2 amd64 jail (example config below). Make sure all dependencies are up to date.

$ cat ~/.flexget/config.yml
    rss: https://feeds.feedburner.com/BsdNowMp3
    accept_all: yes
    limit_new: 1
    exec: fetch -qo "/tmp/{{title}}.mp3" "{{url}}"

$ flexget execute
2021-10-26 06:32:01 VERBOSE  manager                       Creating new database /home/foo/.flexget/db-config.sqlite - DO NOT INTERRUPT ...
2021-10-26 06:32:01 VERBOSE  task_queue                    There are 1 tasks to execute. Shutdown will commence when they have completed.
2021-10-26 06:32:06 VERBOSE  details       bsdnow_mp3      Produced 187 entries.
2021-10-26 06:32:06 VERBOSE  task          bsdnow_mp3      ACCEPTED: `425: Releases galore` by accept_all plugin
2021-10-26 06:32:06 VERBOSE  task          bsdnow_mp3      ACCEPTED: `424: Unveiling OpenBSD’s pledge` by accept_all plugin
2021-10-26 06:32:07 VERBOSE  limit_new     bsdnow_mp3      Allowed 425: Releases galore (https://aphid.fireside.fm/d/....mp3)
2021-10-26 06:32:07 VERBOSE  task          bsdnow_mp3      REJECTED: `424: Unveiling OpenBSD’s pledge` by limit_new plugin because limit exceeded
2021-10-26 06:32:07 VERBOSE  details       bsdnow_mp3      Summary - Accepted: 1 (Rejected: 186 Undecided: 0 Failed: 0)
2021-10-26 06:32:07 VERBOSE  exec          bsdnow_mp3      Executing: fetch -qo "/tmp/425: Releases galore.mp3" "https://aphid.fireside.fm/d/....mp3"
Comment 4 Jan Beich freebsd_committer 2021-10-26 06:55:47 UTC
(In reply to edgeman from comment #1)
> pkg_resources.ContextualVersionConflict: (itsdangerous 2.0.1 (/usr/local/lib/python3.8/site-packages), Requirement.parse('itsdangerous<2.0,>=0.24'), {'flask'})

www/flexget itself doesn't use security/py-itsdangerous. Maybe www/py-flask maintainer have a clue.
Comment 5 Wen Heping freebsd_committer 2021-10-26 10:04:06 UTC
It is strange, in:

flexget-3.1.146 require itsdangerous==2.0.1
Comment 6 Jan Beich freebsd_committer 2021-10-26 10:48:28 UTC
(In reply to Wen Heping from comment #5)
> flexget-3.1.146 require itsdangerous==2.0.1

https://github.com/Flexget/Flexget/commit/31f01a7fcffd is partially reverted in ports, so indirect dependencies are no longer tracked. www/flexget/Makefile has the following:

# Unlock dependencies' versions
	@${MV} ${WRKSRC}/requirements.in ${WRKSRC}/requirements.txt
Comment 7 edgeman 2021-10-26 13:34:57 UTC
I am as up to date as of a gitup last night some time:

portmaster -L reports:
===>>> 415 total installed ports
        ===>>> There are no new versions available

This is on 13.0-RELEASE-p4 amd64 if that matters.

I see there is an update to py-flask from 1.1.4 to 2.0.2 in ports available as of today, I'll update my ports tree and try again. Appreciate it.
Comment 8 edgeman 2021-10-26 16:17:47 UTC
The update to py-flask today appears to have corrected the issue.