google-deepmind / code_contests

Apache License 2.0
2.04k stars 200 forks source link

bazel building error on grpc dependency when using Python 3.10 #22

Closed TenaciousTechnologistExtraordinaire closed 1 year ago

TenaciousTechnologistExtraordinaire commented 1 year ago

When running the first command, I'm getting the following errors:

`root@[COMPUTER NAME]:/tmp/dm-code_contests# bazel run -c opt \

:print_names_and_sources /tmp/dm-code_contests/code_contests_valid.riegeli INFO: Build option --compilation_mode has changed, discarding analysis cache. INFO: Repository local_config_python instantiated at: /tmp/dm-code_contests/WORKSPACE:12:10: in /root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/bazel/grpc_deps.bzl:414:21: in grpc_deps /root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/bazel/grpc_python_deps.bzl:43:21: in grpc_python_deps Repository rule python_configure defined at: /root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl:365:35: in ERROR: An error occurred during the fetch of repository 'local_config_python': Traceback (most recent call last): File "/root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl", line 355, column 35, in _python_autoconf_impl _create_single_version_package( File "/root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl", line 304, column 45, in _create_single_version_package python_include = _get_python_include(repository_ctx, python_bin) File "/root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl", line 236, column 22, in _get_python_include result = _execute( File "/root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl", line 62, column 14, in _execute _fail("\n".join([ File "/root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl", line 35, column 9, in _fail fail("%sPython Configuration Error:%s %s\n" % (red, no_color, msg)) Error in fail: Python Configuration Error: Problem getting python include path for /usr/bin/python3.

:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives :1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead Is the Python binary path set up right? (See ./configure or /usr/bin/python3.) Is distutils installed? Are Python headers installed? Try installing python-dev or python3-dev on Debian-based systems. Try python-devel or python3-devel on Redhat-based systems. ERROR: /tmp/dm-code_contests/WORKSPACE:12:10: fetching python_configure rule //external:local_config_python: Traceback (most recent call last): File "/root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl", line 355, column 35, in _python_autoconf_impl _create_single_version_package( File "/root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl", line 304, column 45, in _create_single_version_package python_include = _get_python_include(repository_ctx, python_bin) File "/root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl", line 236, column 22, in _get_python_include result = _execute( File "/root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl", line 62, column 14, in _execute _fail("\n".join([ File "/root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_github_grpc_grpc/third_party/py/python_configure.bzl", line 35, column 9, in _fail fail("%sPython Configuration Error:%s %s\n" % (red, no_color, msg)) Error in fail: Python Configuration Error: Problem getting python include path for /usr/bin/python3. :1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives :1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead Is the Python binary path set up right? (See ./configure or /usr/bin/python3.) Is distutils installed? Are Python headers installed? Try installing python-dev or python3-dev on Debian-based systems. Try python-devel or python3-devel on Redhat-based systems. ERROR: /root/.cache/bazel/_bazel_root/f815f9c148e5d06107d4dc9766d21406/external/com_google_riegeli/python/riegeli/records/BUILD:27:13: @com_google_riegeli//python/riegeli/records:record_reader_cc depends on @local_config_python//:python_headers in repository @local_config_python which failed to fetch. no such package '@local_config_python//': Python Configuration Error: Problem getting python include path for /usr/bin/python3. :1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives :1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead Is the Python binary path set up right? (See ./configure or /usr/bin/python3.) Is distutils installed? Are Python headers installed? Try installing python-dev or python3-dev on Debian-based systems. Try python-devel or python3-devel on Redhat-based systems. ERROR: Analysis of target '//:print_names_and_sources' failed; build aborted: INFO: Elapsed time: 1.800s INFO: 0 processes. FAILED: Build did NOT complete successfully (1 packages loaded, 218 targets configured) FAILED: Build did NOT complete successfully (1 packages loaded, 218 targets configured)`
TenaciousTechnologistExtraordinaire commented 1 year ago

some output info:

root@[COMPUTER NAME]:/tmp/dm-code_contests# bazel --version bazel 5.3.0 root@[COMPUTER NAME]:/tmp/dm-code_contests# python3 --version Python 3.10.4 root@[COMPUTER NAME]:/tmp/dm-code_contests# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy root@[COMPUTER NAME]:/tmp/dm-code_contests#

felixgimeno commented 1 year ago

Sorry for the delay I have verified this error and found a fix. This is an error caused by using Python 3.10 when trying to build one of the dependencies of the project, specifically https://github.com/grpc/grpc before this particular commit dbe73c9004e483d24168c220cd589fe1824e72bc https://github.com/grpc/grpc/commit/dbe73c9004e483d24168c220cd589fe1824e72bc. Updating the WORKSPACE file to use a newer commit seems to work.