Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bazel examples failing to build due to obscure python deps error #228

Open
xansec opened this issue Jun 30, 2023 · 8 comments
Open

Bazel examples failing to build due to obscure python deps error #228

xansec opened this issue Jun 30, 2023 · 8 comments

Comments

@xansec
Copy link

xansec commented Jun 30, 2023

Expected Behavior

rules_fuzzing examples work "out of the box" (after installing dependencies of course)

Actual Behavior

Examples are not working and are failing due to some strange python error.

Steps to Reproduce the Problem

  1. git clone git@github.com:bazelbuild/rules_fuzzing.git && cd rules_fuzzing
  2. Try to run bazel build //examples:empty_fuzz_target

This results in the following error:

INFO: Repository fuzzing_py_deps_absl_py instantiated at:
  /home/xansec/rules_fuzzing/WORKSPACE:31:13: in <toplevel>
  /home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/fuzzing_py_deps/requirements.bzl:47:20: in install_deps
Repository rule whl_library defined at:
  /home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/rules_python/python/pip_install/pip_repository.bzl:712:30: in <toplevel>
ERROR: An error occurred during the fetch of repository 'fuzzing_py_deps_absl_py':
   Traceback (most recent call last):
        File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/rules_python/python/pip_install/pip_repository.bzl", line 688, column 13, in _whl_library_impl
                fail("whl_library %s failed: %s (%s)" % (rctx.attr.name, result.stdout, result.stderr))
Error in fail: whl_library fuzzing_py_deps_absl_py failed:  (ERROR: Exception:
Traceback (most recent call last):
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/commands/wheel.py", line 108, in run
    session = self.get_default_session(options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 98, in get_default_session
    self._session = self.enter_context(self._build_session(options))
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 188, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 183, in <genexpr>
    matches = (
              ^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/base.py", line 612, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 175, in _iter_distributions
    yield from finder.find(location)
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 79, in find
    for dist, info_location in self._find_impl(location):
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 64, in _find_impl
    raw_name = get_dist_name(dist)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_compat.py", line 52, in get_dist_name
    name = cast(Any, dist).name
           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PathDistribution' object has no attribute 'name'
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/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
             ^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
           ^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/base_command.py", line 216, in _main
    self.handle_pip_version_check(options)
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 179, in handle_pip_version_check
    session = self._build_session(
              ^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 188, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 183, in <genexpr>
    matches = (
              ^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/base.py", line 612, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 175, in _iter_distributions
    yield from finder.find(location)
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 79, in find
    for dist, info_location in self._find_impl(location):
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 64, in _find_impl
    raw_name = get_dist_name(dist)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_compat.py", line 52, in get_dist_name
    name = cast(Any, dist).name
           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PathDistribution' object has no attribute 'name'
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/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 450, in <module>
    main()
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 427, in main
    subprocess.run(pip_args, check=True, env=env)
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--isolated', 'wheel', '--no-deps', '--require-hashes', '-r', '/tmp/tmp2tuw44f9']' returned non-zero exit status 1.
)
ERROR: /home/xansec/rules_fuzzing/WORKSPACE:31:13: fetching whl_library rule //external:fuzzing_py_deps_absl_py: Traceback (most recent call last):
        File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/rules_python/python/pip_install/pip_repository.bzl", line 688, column 13, in _whl_library_impl
                fail("whl_library %s failed: %s (%s)" % (rctx.attr.name, result.stdout, result.stderr))
Error in fail: whl_library fuzzing_py_deps_absl_py failed:  (ERROR: Exception:
Traceback (most recent call last):
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/commands/wheel.py", line 108, in run
    session = self.get_default_session(options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 98, in get_default_session
    self._session = self.enter_context(self._build_session(options))
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 188, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 183, in <genexpr>
    matches = (
              ^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/base.py", line 612, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 175, in _iter_distributions
    yield from finder.find(location)
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 79, in find
    for dist, info_location in self._find_impl(location):
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 64, in _find_impl
    raw_name = get_dist_name(dist)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_compat.py", line 52, in get_dist_name
    name = cast(Any, dist).name
           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PathDistribution' object has no attribute 'name'
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/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
             ^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
           ^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/base_command.py", line 216, in _main
    self.handle_pip_version_check(options)
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 179, in handle_pip_version_check
    session = self._build_session(
              ^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 188, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 183, in <genexpr>
    matches = (
              ^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/base.py", line 612, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 175, in _iter_distributions
    yield from finder.find(location)
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 79, in find
    for dist, info_location in self._find_impl(location):
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 64, in _find_impl
    raw_name = get_dist_name(dist)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_compat.py", line 52, in get_dist_name
    name = cast(Any, dist).name
           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PathDistribution' object has no attribute 'name'
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/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 450, in <module>
    main()
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 427, in main
    subprocess.run(pip_args, check=True, env=env)
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--isolated', 'wheel', '--no-deps', '--require-hashes', '-r', '/tmp/tmp2tuw44f9']' returned non-zero exit status 1.
)
ERROR: /home/xansec/rules_fuzzing/fuzzing/tools/BUILD:31:10: //fuzzing/tools:make_corpus_dir depends on @fuzzing_py_deps_absl_py//:pkg in repository @fuzzing_py_deps_absl_py which failed to fetch. no such package '@fuzzing_py_deps_absl_py//': whl_library fuzzing_py_deps_absl_py failed:  (ERROR: Exception:
Traceback (most recent call last):
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/commands/wheel.py", line 108, in run
    session = self.get_default_session(options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 98, in get_default_session
    self._session = self.enter_context(self._build_session(options))
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 188, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 183, in <genexpr>
    matches = (
              ^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/base.py", line 612, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 175, in _iter_distributions
    yield from finder.find(location)
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 79, in find
    for dist, info_location in self._find_impl(location):
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 64, in _find_impl
    raw_name = get_dist_name(dist)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_compat.py", line 52, in get_dist_name
    name = cast(Any, dist).name
           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PathDistribution' object has no attribute 'name'
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/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
             ^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
           ^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/base_command.py", line 216, in _main
    self.handle_pip_version_check(options)
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 179, in handle_pip_version_check
    session = self._build_session(
              ^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 188, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 183, in <genexpr>
    matches = (
              ^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/base.py", line 612, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 175, in _iter_distributions
    yield from finder.find(location)
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 79, in find
    for dist, info_location in self._find_impl(location):
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_envs.py", line 64, in _find_impl
    raw_name = get_dist_name(dist)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/pypi__pip/pip/_internal/metadata/importlib/_compat.py", line 52, in get_dist_name
    name = cast(Any, dist).name
           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PathDistribution' object has no attribute 'name'
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/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 450, in <module>
    main()
  File "/home/xansec/.cache/bazel/_bazel_xansec/3c1ff63d7ec3e40e9da6884ef889497c/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 427, in main
    subprocess.run(pip_args, check=True, env=env)
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--isolated', 'wheel', '--no-deps', '--require-hashes', '-r', '/tmp/tmp2tuw44f9']' returned non-zero exit status 1.
)
ERROR: Analysis of target '//examples:empty_fuzz_test' failed; build aborted: 
INFO: Elapsed time: 0.920s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
    Fetching @local_config_cc; fetching

This seems to be a pip issue? For the record, I also forked and created a release from HEAD since I saw that rules_python and installation steps were updated, however following the latest commit did not resolve the problem either.

Things I've tried

  • Changing python versions
  • Explicitly including rules_python
  • Reinstalling bazel

Specifications

  • Version:
    rules_fuzzing-0.3.2
    bazel-5.4.0
    Python 3.11.3
    pip 23.1.2
    clang 15.0.7
  • Platform:
    Manjaro Linux 6.1.31-2-MANJARO
@stefanbucur
Copy link
Collaborator

Thanks for reporting this issue! Can you confirm it is still happening at the repository HEAD? There were some fixes checked in past v0.3.2, but they haven't yet been incorporated in a new release.

@xansec
Copy link
Author

xansec commented Jun 30, 2023

Yes, I can confirm. I created my own release here pointing to HEAD:
https://github.com/xansec/rules_fuzzing/releases/tag/rules_fuzzing-0.3.3

And received the same issue. Only thing I changed was default clang toolchain because I didn't want to install clang10, but this should be unrelated to the problem.

@xansec
Copy link
Author

xansec commented Jun 30, 2023

Also of note, this command (referenced in the above error output):

subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--isolated', 'wheel', '--no-deps', 
'--require-hashes', '-r', '/tmp/tmp2tuw44f9']' returned non-zero exit status 1.

when I run manually succeeds, so this must be failing in the bazel environment somewhere.

@FreezyLemon
Copy link

I hit this too. The relevant error seems to be:
AttributeError: 'PathDistribution' object has no attribute 'name'

Which seems to be a problem with python 3.11 and the importlib_metadata package.

@FreezyLemon
Copy link

The following is a workaround that worked for me:

  1. Install Python 3.9
  2. Symlink python3 to be Python 3.9
  3. Rerun the bazel command

@xansec
Copy link
Author

xansec commented Dec 6, 2023

Thanks! As an aside, I was also able to workaround this with pyenv:

pyenv global 3.9.0

I'm sure local will work if you use conda or venvs.

@florianGla
Copy link

Any plans to support python 3.10 or later? Ubuntu 24.04 ships with python 3.12 by default and throws a similar dependency error (cc @fmeum).

@fmeum
Copy link
Member

fmeum commented Jun 3, 2024

@florianGla What is the exact error you are seeing and what's the command you ran to get it? I just verified that I can run all the examples just fine in a Docker container with Ubuntu 24.04, clang 18 and Python 3.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants