Skip to content

1.5.0 breaks pip support for Python 3.8 #3050

@thirtyseven

Description

@thirtyseven

🐞 bug report

Affected Rule

The issue is caused by the rule: pip_parse

Is this a regression?

Yes, the previous version in which this bug was not present was: 1.4.1

Description

rules_python 1.5.0 upgraded its internal setuputils to 78.1.1 which has a minimum supported Python version of 3.9. Using this version with Python 3.8 leads to errors (see below) although for some reason, I only see them on Linux builds, not Mac.

I think dropping 3.8 support is reasonable given that it is EOL, but 3.8 is still included in versions.bzl and no announcement was made in CHANGELOG.md.

🔬 Minimal Reproduction

🔥 Exception or Error




Collecting pyspark==3.5.1 (from -r /tmp/tmpxgf31w1w (line 1))
  File was already downloaded /mnt/builds/cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/rules_python~~pip~py3deps_38_pyspark_sdist_dd6569e5/pyspark-3.5.1.tar.gz
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
===== stdout end =====
===== stderr start =====
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      Traceback (most recent call last):
        File "", line 2, in 
        File "", line 14, in 
        File "/mnt/builds/cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/rules_python~~internal_deps~pypi__setuptools/setuptools/__init__.py", line 22, in 
          import _distutils_hack.override  # noqa: F401
        File "/mnt/builds/cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/rules_python~~internal_deps~pypi__setuptools/_distutils_hack/override.py", line 1, in 
          __import__('_distutils_hack').do_override()
        File "/mnt/builds/cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/rules_python~~internal_deps~pypi__setuptools/_distutils_hack/__init__.py", line 89, in do_override
          ensure_local_distutils()
        File "/mnt/builds/cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/rules_python~~internal_deps~pypi__setuptools/_distutils_hack/__init__.py", line 75, in ensure_local_distutils
          core = importlib.import_module('distutils.core')
        File "/mnt/builds/cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/rules_python~~python~python_3_8_x86_64-unknown-linux-gnu/lib/python3.8/importlib/__init__.py", line 127, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "/mnt/builds/cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/rules_python~~internal_deps~pypi__setuptools/setuptools/_distutils/core.py", line 20, in 
          from .dist import Distribution
        File "/mnt/builds/cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/rules_python~~internal_deps~pypi__setuptools/setuptools/_distutils/dist.py", line 51, in 
          Union[tuple[str, Union[str, None], str, int], tuple[str, Union[str, None], str]]
      TypeError: 'type' object is not subscriptable

🌍 Your Environment

Operating System:

  
Ubuntu 20.04
  

Output of bazel version:

  
Bazelisk version: v1.19.0
Build label: 7.5.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Thu Jan 30 18:33:17 2025 (1738261997)
Build timestamp: 1738261997
Build timestamp as int: 1738261997
  

Rules_python version:

  
1.5.0
  

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions