From 79ceb4c45c5cd9223dd4bed8701cdf6a0da9cc9f Mon Sep 17 00:00:00 2001 From: Lucas Chollet Date: Mon, 12 Aug 2024 11:58:35 -0400 Subject: [PATCH] build: update python_rules to support Python 3.12 (#2654) Before, when trying to use to build the project using Bazel, this would result in multiple occurrence of this error: `AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?` This error is due to `rules_python` being too old. While building with Python3.12 still result in an error, the new one clearly indicate is mismatch of the TensorFlow version. Very similar/related: https://github.com/googleapis/gapic-generator-python/pull/1825 BUG=https://github.com/tensorflow/tensorflow/issues/73174 --- WORKSPACE | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 7e76e1e3dae..48202f5c003 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -33,13 +33,19 @@ load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_ hedron_compile_commands_setup() +_rules_python_version = "0.26.0" + http_archive( name = "rules_python", - sha256 = "0a8003b044294d7840ac7d9d73eef05d6ceb682d7516781a4ec62eeb34702578", - strip_prefix = "rules_python-0.24.0", - url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.24.0.tar.gz", + sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b", + strip_prefix = "rules_python-{}".format(_rules_python_version), + url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/{}.tar.gz".format(_rules_python_version), ) +load("@rules_python//python:repositories.bzl", "py_repositories") + +py_repositories() + # Read the Python package dependencies of the build environment. To modify # them, see //third_party:python_requirements.in. load("@rules_python//python:pip.bzl", "pip_parse")