Closed Bug 1772777 Opened 4 years ago Closed 2 years ago

`moz-phab` stopped working on Windows

Categories

(Conduit :: moz-phab, defect, P3)

Production
x86_64
Windows 11

Tracking

(Not tracked)

RESOLVED INACTIVE

People

(Reporter: masayuki, Unassigned)

Details

(Keywords: conduit-triaged, Whiteboard: workaround in comment 2)

In a couple of days, moz-phab started to output the following errors:

$ moz-phab help
Traceback (most recent call last):
  File "C:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 581, in _build_master
    ws.require(__requires__)
  File "C:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 909, in require
    needed = self.resolve(parse_requirements(requirements))
  File "C:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 800, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (python-hglib 2.6.2 (c:\mozilla-build\python3\lib\site-packages), Requirement.parse('python-hglib==2.6.1'), {'MozPhab'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\mozilla-build\python3\Scripts\moz-phab-script.py", line 33, in <module>
    sys.exit(load_entry_point('MozPhab==1.0.0', 'console_scripts', 'moz-phab')())
  File "C:\mozilla-build\python3\Scripts\moz-phab-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "C:\mozilla-build\python3\lib\importlib\metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "C:\mozilla-build\python3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\mozilla-build\python3\lib\site-packages\mozphab\mozphab.py", line 17, in <module>
    from mozphab import environment
  File "C:\mozilla-build\python3\lib\site-packages\mozphab\environment.py", line 6, in <module>
    import pkg_resources
  File "C:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 3260, in <module>
    def _initialize_master_working_set():
  File "C:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 3234, in _call_aside
    f(*args, **kwargs)
  File "C:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 3272, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "C:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 583, in _build_master
    return cls._build_from_requirements(__requires__)
  File "C:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 596, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "C:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 795, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'python-hglib==2.6.1' distribution was not found and is required by MozPhab

I use MozillaBuild 4.0.1, and I tried to create an environment for ESR91, but it fails, then, I started to see this error, but I'm not sure whether it's caused by this because I still see this error even after I rebuild with mach bootstrap with deleting ~/.mozilla-build folder completely.

I had this some days ago and now again. Before this moz-phab tried an update which failed with an access denied:

Installing collected packages: python-hglib, packaging, glean-parser, glean-sdk, MozPhab
  Attempting uninstall: python-hglib
    Found existing installation: python-hglib 2.6.1
    Uninstalling python-hglib-2.6.1:
      Successfully uninstalled python-hglib-2.6.1
  Running setup.py install for python-hglib ... done
  Attempting uninstall: glean-parser
    Found existing installation: glean-parser 5.0.1
    Uninstalling glean-parser-5.0.1:
      Successfully uninstalled glean-parser-5.0.1
  Attempting uninstall: glean-sdk
    Found existing installation: glean-sdk 44.0.0
    Uninstalling glean-sdk-44.0.0:
      Successfully uninstalled glean-sdk-44.0.0
ERROR: Could not install packages due to an OSError: [WinError 5] Zugriff verweigert: 'C:\\mozilla-build\\python3\\Lib\\site-packages\\~lean\\glean_ffi.dll'
Consider using the `--user` option or check the permissions.

Note that the access denied some days ago was on ~arkupsafe.

I was able to make moz-phab working again with pip install python-hglib==2.6.1.

Now I tried pip install mozphab==1.1.0 and this time it went through.

Component: General → moz-phab
Product: Firefox Build System → Conduit
Version: unspecified → Production

I'm not sure what the root cause of this is, Zeid probably has a better idea.

I too ran in to this on Friday, what worked for me was uninstalling it then re-installing it.

On Slack, Zeid suggested to somebody else to run python3 -m pip install --upgrade MozPhab and that worked for them.

Note that before bug 1771099, moz-phab had a non-strict dependency on glean because of issues like this (IIRC), because it will likely happen again when m-c is updated to glean >= 51.

This is likely because on Windows, after self-update runs the old binary is still being used but by that time the required package upgrades had already happened. This is mainly because in 1.0.0 moz-phab required python-hglib==2.6.1, and in later version it is more flexible, but with a higher minimum version.

Whiteboard: solution in comment 2
Whiteboard: solution in comment 2 → workaround in comment 2

Note: this bug appears to only affect Windows but may require further testing.

Steps to reproduce:

  • Release a new version of moz-phab which requires a package version that is not compatible with the current installed version
  • Run moz-phab self-update

Expected outcome:

  • self-update should install the new requirements and upgrade moz-phab without any error

Actual outcome:

  • self-update fails because the requirement that was required by the old version is no longer installed, and the old moz-phab is still being used

A manual upgrade (i.e. via pip) is required to resolve this problem on the user's machine.

Priority: -- → P3
Severity: -- → S3
Keywords: conduit-triaged

Seems like we haven't hit this in a while, possibly because we disabled the Windows self-updater. Closing as inactive.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.