Bug 1877558 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

This breaks `./mach lint` along with anything else that uses `mach.site.install_pip_requirements`.

Full traceback:
```
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
             ^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
           ^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/cli/base_command.py", line 216, in _main
    self.handle_pip_version_check(options)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/cli/req_command.py", line 179, in handle_pip_version_check
    session = self._build_session(
              ^^^^^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/importlib/_envs.py", line 188, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/importlib/_envs.py", line 183, in <genexpr>
    matches = (
              ^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/base.py", line 612, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/importlib/_envs.py", line 176, in _iter_distributions
    for dist in finder.find_eggs(location):
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/importlib/_envs.py", line 144, in find_eggs
    yield from self._find_eggs_in_dir(location)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/importlib/_envs.py", line 111, in _find_eggs_in_dir
    from pip._vendor.pkg_resources import find_distributions
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 3254, in <module>
    @_call_aside
     ^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 3238, in _call_aside
    f(*args, **kwargs)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 3280, in _initialize_master_working_set
    tuple(
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 3281, in <genexpr>
    dist.activate(replace=False)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 2788, in activate
    declare_namespace(pkg)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 2286, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 2203, in _handle_ns
    loader = importer.find_module(packageName)
             ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FileFinder' object has no attribute 'find_module'

Traceback (most recent call last):
  File "/home/ahal/dev/mozilla-unified/python/mozlint/mozlint/roller.py", line 233, in setup
    res = findobject(linter["setup"])(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/tools/lint/python/black.py", line 131, in setup
    virtualenv_manager.install_pip_requirements(BLACK_REQUIREMENTS_PATH, quiet=True)
  File "/home/ahal/dev/mozilla-unified/python/mach/mach/site.py", line 656, in install_pip_requirements
    raise InstallPipRequirementsException(
mach.site.InstallPipRequirementsException: Failed to install "/home/ahal/dev/mozilla-unified/tools/lint/python/black_requirements.txt" into the "lint" site.
```

I'm guess we need to update our vendored `pip` or something like that.
This breaks `./mach lint` along with anything else that uses `mach.site.install_pip_requirements`.

Full traceback:
```
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
             ^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
           ^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/cli/base_command.py", line 216, in _main
    self.handle_pip_version_check(options)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/cli/req_command.py", line 179, in handle_pip_version_check
    session = self._build_session(
              ^^^^^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/importlib/_envs.py", line 188, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/importlib/_envs.py", line 183, in <genexpr>
    matches = (
              ^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/base.py", line 612, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/importlib/_envs.py", line 176, in _iter_distributions
    for dist in finder.find_eggs(location):
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/importlib/_envs.py", line 144, in find_eggs
    yield from self._find_eggs_in_dir(location)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_internal/metadata/importlib/_envs.py", line 111, in _find_eggs_in_dir
    from pip._vendor.pkg_resources import find_distributions
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 3254, in <module>
    @_call_aside
     ^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 3238, in _call_aside
    f(*args, **kwargs)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 3280, in _initialize_master_working_set
    tuple(
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 3281, in <genexpr>
    dist.activate(replace=False)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 2788, in activate
    declare_namespace(pkg)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 2286, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/home/ahal/dev/mozilla-unified/third_party/python/pip/pip/_vendor/pkg_resources/__init__.py", line 2203, in _handle_ns
    loader = importer.find_module(packageName)
             ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FileFinder' object has no attribute 'find_module'

Traceback (most recent call last):
  File "/home/ahal/dev/mozilla-unified/python/mozlint/mozlint/roller.py", line 233, in setup
    res = findobject(linter["setup"])(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ahal/dev/mozilla-unified/tools/lint/python/black.py", line 131, in setup
    virtualenv_manager.install_pip_requirements(BLACK_REQUIREMENTS_PATH, quiet=True)
  File "/home/ahal/dev/mozilla-unified/python/mach/mach/site.py", line 656, in install_pip_requirements
    raise InstallPipRequirementsException(
mach.site.InstallPipRequirementsException: Failed to install "/home/ahal/dev/mozilla-unified/tools/lint/python/black_requirements.txt" into the "lint" site.
```

I guess we need to update our vendored `pip` or something like that.

Back to Bug 1877558 Comment 0