Bug 264266 - www/mitmproxy: Fails to run: pkg_resources.DistributionNotFound: The 'wsproto<1.1,>=1.0' distribution was not found and is required by mitmproxy
Summary: www/mitmproxy: Fails to run: pkg_resources.DistributionNotFound: The 'wsproto...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Muhammad Moinur Rahman
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2022-05-26 22:15 UTC by Lorenzo Salvadore
Modified: 2022-06-03 07:28 UTC (History)
3 users (show)

See Also:
gaod: maintainer-feedback+
koobs: maintainer-feedback? (bofh)


Attachments
mitmproxy-7.0.4_2 patch (4.46 KB, patch)
2022-05-30 08:51 UTC, Hung-Yi Chen
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Salvadore freebsd_committer freebsd_triage 2022-05-26 22:15:31 UTC
When I try to run mitmproxy I get the following error message:

---

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 568, in _build_master
    ws.require(__requires__)
  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: (wsproto 1.1.0 (/usr/local/lib/python3.8/site-packages), Requirement.parse('wsproto<1.1,>=1.0'), {'mitmproxy'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/mitmproxy", line 33, in <module>
    sys.exit(load_entry_point('mitmproxy==7.0.4', 'console_scripts', 'mitmproxy')())
  File "/usr/local/bin/mitmproxy", 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/mitmproxy/tools/main.py", line 8, in <module>
    from mitmproxy import exceptions, master
  File "/usr/local/lib/python3.8/site-packages/mitmproxy/master.py", line 10, in <module>
    from mitmproxy import eventsequence
  File "/usr/local/lib/python3.8/site-packages/mitmproxy/eventsequence.py", line 8, in <module>
    from mitmproxy.proxy import layers
  File "/usr/local/lib/python3.8/site-packages/mitmproxy/proxy/layers/__init__.py", line 1, in <module>
    from . import modes
  File "/usr/local/lib/python3.8/site-packages/mitmproxy/proxy/layers/modes.py", line 9, in <module>
    from mitmproxy.proxy.layers import tls
  File "/usr/local/lib/python3.8/site-packages/mitmproxy/proxy/layers/tls.py", line 8, in <module>
    from mitmproxy.net import tls as net_tls
  File "/usr/local/lib/python3.8/site-packages/mitmproxy/net/tls.py", line 18, in <module>
    from mitmproxy.contrib.kaitaistruct import tls_client_hello
  File "/usr/local/lib/python3.8/site-packages/mitmproxy/contrib/kaitaistruct/tls_client_hello.py", line 7, in <module>
    from pkg_resources import parse_version
  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 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'wsproto<1.1,>=1.0' distribution was not found and is required by mitmproxy

---

On my system I have py38-wsproto version 1.1.0 installed. I think the the problem is that wsproto<1.1 is required.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2022-05-27 00:22:13 UTC
wsproto was updated to 1.1 in ports 5d9614866d90

mitmproxy *_DEPENDS are incorrect or not completely specified, which makes QA difficult at best.

  py38-wsproto>=1.0.0 : net/py-wsproto@py38 (missing max version)

All *_DEPENDS should be reviewed and updated to match upstream (setup.py, etc) version-spec declarations.
Comment 2 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2022-05-30 02:40:02 UTC
(In reply to Kubilay Kocak from comment #1)
I can make a quick update to mitmproxy but again py-cryptography and py-pyopenssl needs updating for the update.
Comment 3 Hung-Yi Chen 2022-05-30 08:49:27 UTC
Make the port as BROKEN & add RUN_DEPENDS max version check first.

I'm working on mitmproxy 8.1.0's PR and related ports'.
Comment 4 Hung-Yi Chen 2022-05-30 08:51:36 UTC
Created attachment 234322 [details]
mitmproxy-7.0.4_2 patch
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-06-03 05:48:30 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=746da630a838ff9fc88025f0b6033a661460fbef

commit 746da630a838ff9fc88025f0b6033a661460fbef
Author:     Hung-Yi Chen <gaod@hychen.org>
AuthorDate: 2022-06-03 04:58:32 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2022-06-03 05:48:10 +0000

    www/mitmproxy: Mark BROKEN

    - Runtime fail after py-wsproto update

    PR:             264266
    Approved by:    gaod@hychen.org (maintainer)

 www/mitmproxy/Makefile | 56 ++++++++++++++++++++++++++------------------------
 1 file changed, 29 insertions(+), 27 deletions(-)
Comment 6 p5B2EA84B3 2022-06-03 07:14:49 UTC
The last commit did not remove the BROKEN flag !!
Comment 7 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2022-06-03 07:28:18 UTC
(In reply to p5B2EA84B3 from comment #6)
The purpose was to mark it BROKEN as mentioned by the MAINTAINER in comment #3