Closed Bug 1761444 Opened 3 years ago Closed 3 years ago

Installing MozillaBuild 4 irreversibly broke moz-phab

Categories

(Firefox Build System :: MozillaBuild, defect)

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: emk, Unassigned)

References

(Regression)

Details

After I installed MozillaBuild 4, and run moz-phab, I got this error:

$ moz-phab 8c6479f46dc8
Traceback (most recent call last):
  File "D:\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 "D:\mozilla-build\python3\Scripts\moz-phab-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "d:\mozilla-build\python3\lib\importlib\metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "d:\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 "d:\mozilla-build\python3\lib\site-packages\mozphab\mozphab.py", line 17, in <module>
    from mozphab import environment
  File "d:\mozilla-build\python3\lib\site-packages\mozphab\environment.py", line 6, in <module>
    import pkg_resources
  File "d:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 3247, in <module
>
    def _initialize_master_working_set():
  File "d:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 3221, in _call_a
side
    f(*args, **kwargs)
  File "d:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 3259, in _initia
lize_master_working_set
    working_set = WorkingSet._build_master()
  File "d:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 579, in _build_m
aster
    ws.require(__requires__)
  File "d:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 897, in require
    needed = self.resolve(parse_requirements(requirements))
  File "d:\mozilla-build\python3\lib\site-packages\pkg_resources\__init__.py", line 783, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'cffi>=1.13.0' distribution was not found and is required by
 glean-sdk

Even after I reverted to MozillaBuild 3.4, I got this error:

$ moz-phab .
Traceback (most recent call last):
  File "d:\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 "d:\mozilla-build\python3\Scripts\moz-phab-script.py", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "d:\mozilla-build\python3\lib\importlib\metadata.py", line 533, in distribution
    return Distribution.from_name(distribution_name)
  File "d:\mozilla-build\python3\lib\importlib\metadata.py", line 187, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: MozPhab

It works for me, but I had to completely uninstall and reinstall it through pip3 and ensure I had mozilla-build/python3/Scripts/ in my PATH

To restore MozPhab,

  • Removed ~/.mozbuild/moz-phab
  • Removed %appdata%\python\python37\site-packages
  • Edited ~/.bash_profile to remove moz-phab 0.9 from $PATH
  • Removed mozilla-build installation directory and re-installed MozillaBuild 3.4.

I won't test MozillaBuild 4 for a while.

Regressed by: 1739443
No longer regressed by: 1761015

I retried and got this error this time:

$ moz-phab
Traceback (most recent call last):
  File "D:\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 "D:\mozilla-build\python3\Scripts\moz-phab-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "D:\mozilla-build\python3\lib\importlib\metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "D:\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 "D:\mozilla-build\python3\lib\site-packages\mozphab\mozphab.py", line 19, in <module>
    from .args import parse_args
  File "D:\mozilla-build\python3\lib\site-packages\mozphab\args.py", line 14, in <module>
    from .detect_repository import find_repo_root
  File "D:\mozilla-build\python3\lib\site-packages\mozphab\detect_repository.py", line 8, in <module>
    from .git import Git
  File "D:\mozilla-build\python3\lib\site-packages\mozphab\git.py", line 30, in <module>
    from .telemetry import telemetry
  File "D:\mozilla-build\python3\lib\site-packages\mozphab\telemetry.py", line 9, in <module>
    from glean import Glean, Configuration, load_metrics, load_pings
  File "D:\mozilla-build\python3\lib\site-packages\glean\__init__.py", line 17, in <module>
    from .glean import Glean
  File "D:\mozilla-build\python3\lib\site-packages\glean\glean.py", line 22, in <module>
    from .config import Configuration
  File "D:\mozilla-build\python3\lib\site-packages\glean\config.py", line 13, in <module>
    from . import net
  File "D:\mozilla-build\python3\lib\site-packages\glean\net\__init__.py", line 14, in <module>
    from .ping_upload_worker import PingUploadWorker
  File "D:\mozilla-build\python3\lib\site-packages\glean\net\ping_upload_worker.py", line 14, in <module>
    from .upload_task_tag import UploadTaskTag
  File "D:\mozilla-build\python3\lib\site-packages\glean\net\upload_task_tag.py", line 8, in <module>
    from .. import _ffi
  File "D:\mozilla-build\python3\lib\site-packages\glean\_ffi.py", line 14, in <module>
    from ._glean_ffi import ffi  # type: ignore
  File "D:\mozilla-build\python3\lib\site-packages\glean\_glean_ffi.py", line 2, in <module>
    import _cffi_backend
ModuleNotFoundError: No module named '_cffi_backend'

pip3 uninstall cffi && pip3 install cffi solved the issue.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME

Edited ~/.bash_pprofile to removed moz-phab 0.9 from $PATH

This was likely the culprit here: pip is pretty flexible and unstructured when finding dependencies, so I'm guessing that your moz-phab installation was strewn between MozillaBuild 3.4 and %appdata%\python\python37\site-packages.

If you're interested in diagnosing why moz-phab isn't working with MozillaBuild 4.0 on your machine, the output of the following commands would be helpful:

  1. Install and run MozillaBuild 4.0
  2. pip3 install moz-phab
  3. pip3 list -v
  4. which moz-phab
  5. moz-phab version
Flags: needinfo?(VYV03354)

To be clear, MozillaBuild 4.0 works for me now. (See comment #3.)

Flags: needinfo?(VYV03354)

Hmm, is there any chance that you directly installed MozillaBuild 4.0 over top of MozillaBuild 3.4, as it occurred over in this bug?
As documented on the wiki, it's recommended to fully remove the old version of MozillaBuild before installing the new one.
If you did indeed do a "pave-over" install, then that was likely what caused your moz-phab woes.

See Also: → 1761992

Yeah, I did a "pave-over" install at first. Then I completely removed the mozilla-build folder and installed MozillaBuild 4.0. problem solved.

Product: mozilla.org → Firefox Build System
You need to log in before you can comment on or make changes to this bug.