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

About the CI issue "AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?" #384

Open
lum1n0us opened this issue Feb 26, 2024 · 2 comments

Comments

@lum1n0us
Copy link
Contributor

There is a common CI issue on macOS/x86-64 about pkgutil. ImpImporter triggered by 'rules_python"

ERROR: An error occurred during the fetch of repository 'fuzzing_py_deps':
   Traceback (most recent call last):
	File "/private/var/tmp/_bazel_runner/f7b5b126cb65bf12475e[29](https://github.com/proxy-wasm/proxy-wasm-cpp-host/actions/runs/8042165716/job/21962477785#step:9:30)2acf07553d/external/rules_python/python/pip_install/pip_repository.bzl", line 171, column 13, in _pip_repository_impl
		fail("rules_python failed: %s (%s)" % (result.stdout, result.stderr))
Error in fail: rules_python failed:  (Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 148, in _get_module_details
  File "<frozen runpy>", line 112, in _get_module_details
  File "/private/var/tmp/_bazel_runner/f7b5b126cb65bf12[47](https://github.com/proxy-wasm/proxy-wasm-cpp-host/actions/runs/8042165716/job/21962477785#step:9:48)5e292acf07553d/external/rules_python/python/pip_install/extract_wheels/__init__.py", line 15, in <module>
    from python.pip_install.extract_wheels.lib import arguments, bazel, requirements
  File "/private/var/tmp/_bazel_runner/f7b5b126cb65bf12475e292acf07553d/external/rules_python/python/pip_install/extract_wheels/lib/bazel.py", line 9, in <module>
    from python.pip_install.extract_wheels.lib import namespace_pkgs, purelib, wheel
  File "/private/var/tmp/_bazel_runner/f7b5b126cb65bf12475e292acf07553d/external/rules_python/python/pip_install/extract_wheels/lib/purelib.py", line 6, in <module>
    from python.pip_install.extract_wheels.lib import wheel
  File "/private/var/tmp/_bazel_runner/f7b5b126cb65bf12475e292acf07553d/external/rules_python/python/pip_install/extract_wheels/lib/wheel.py", line 9, in <module>
    import pkg_resources
  File "/private/var/tmp/_bazel_runner/f7b5b126cb65bf12475e292acf07553d/external/pypi__setuptools/pkg_resources/__init__.py", line 2158, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

It turns out that pkgutil.ImpImporter, as a long-deprecated class, has been removed from python 3.12. A proper way of fixing is upgrade rules_python.

But if using the latest rules_python 0.31, another error will be meet.

ERROR: /root/.cache/bazel/_bazel_root/adb5dd13720c6f98da219c2f1ac0ff1a/external/rules_python/python/private/common/py_executable.bzl:840:12: name 'RunEnvironmentInfo' is not defined

It is because RunEnvironmentInfo is not exposed in Bazel < 5.3. Currently, proxy-wasm-cpp-host is using Build label: 5.2.0.

So I am kind of stuck here, shall I ?

  • try with another version of rules_python
  • just upgrade bazel environment
  • something else
@PiotrSikora
Copy link
Contributor

Updating Bazel to 7.x and rules_python seems like a way to go. Thanks!

@lum1n0us
Copy link
Contributor Author

Sorry for delayed response.

The new rules_python provides a different way for pip_install() and it beats me. Hope #389 can resolve it.

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

2 participants