Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

wheel_installer with --platform fails for non-cp abis #1810

Copy link
Copy link
Closed
@Illedran

Description

@Illedran
Issue body actions

🐞 bug report

Affected Rule

Users of the wheel_installer tool - e.g. like the generated repos from pip_parse when used with experimental_target_platforms.

Is this a regression?

Yes - works on 0.29.0 (likely due to #1693 cc: @aignas).

Description

The wheel_installer tool is defensive when parsing the --platform flag and checks whether the abi starts with cp - this is a problem when wheels do not use that abi (but are nevertheless compatible, see below) as it then tries to find the OS to target using the abi name instead.

For example, in the linked reproduction below, pip ends up downloading:

  • tornado-6.4-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl - abi_tag == "abi3" (link on PyPI)
  • libclang-17.0.6-py2.py3-none-manylinux2010_x86_64.whl - abi_tag == "none" (link on PyPI)

Relevant PEPs:

🔬 Minimal Reproduction

See https://github.com/Illedran/wheel_installer_tool_abi_bug.

🔥 Exception or Error

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/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 205, in <module>
    main()
  File "/home/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 149, in main
    args = arguments.parser(description=__doc__).parse_args()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/argparse.py", line 1891, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/argparse.py", line 1924, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/argparse.py", line 2136, in _parse_known_args
    start_index = consume_optional(start_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/argparse.py", line 2076, in consume_optional
    take_action(action, args, option_string)
  File "/home/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/argparse.py", line 1984, in take_action
    argument_values = self._get_values(action, argument_strings)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/argparse.py", line 2522, in _get_values
    value = self._get_value(action, arg_string)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/argparse.py", line 2555, in _get_value
    result = type_func(arg_string)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/home/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/rules_python/python/pip_install/tools/wheel_installer/wheel.py", line 205, in from_string
    os=OS[os] if os != "*" else None,
       ~~^^^^
  File "/home/illedran/.cache/bazel/_bazel_illedran/527668b0d651ad7c51390aa36afa823c/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/enum.py", line 801, in __getitem__
    return cls._member_map_[name]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'abi3'

See the README.md for the full error log (incl. Bazel) and another example.

🌍 Your Environment

Operating System:

Linux 5.15.146.1-microsoft-standard-WSL2 x86_64

Output of bazel version:

Bazelisk version: v1.18.0
Build label: 7.0.2
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Thu Jan 25 16:13:35 2024 (1706199215)
Build timestamp: 1706199215
Build timestamp as int: 1706199215

Rules_python version:

0.31.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.