Skip to content

pip.parse parsing all requirements files fails on platform specific wheel downloads #2450

@keith

Description

@keith

🐞 bug report

Affected Rule

On this branch: #2449 which sets up pypi for 3 different platforms with different requirements files. Running bazel query 'deps(...)' results in a wheel download failure if you're not on x86_64 linux, since the deps for that platform are not available on other platforms:

===== stderr end ===== and referenced by '@@rules_python~~pip~pip//torch:pkg'
ERROR: Evaluation of query "deps(...)" failed: preloading transitive closure failed: no such package '@@rules_python~~pip~pip_311_torch_linux_x86_64//':
rules_python:whl_library(@@rules_python~~pip~pip_311_torch_linux_x86_64) FAIL: repo.execute: whl_library.ResolveRequirement(rules_python~~pip~pip_311_torch_linux_x86_64, torch==2.4.1+cpu): end: failure:
  command: /home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~python~python_3_11_host/python -m python.private.pypi.whl_installer.wheel_installer --requirement torch==2.4.1+cpu --isolated --extra_pip_args "{\"arg\":[\"--index-url\",\"https://pypi.org/simple\",\"--extra-index-url\",\"https://download.pytorch.org/whl/cpu\"]}" --pip_data_exclude "{\"arg\":[]}" --environment "{\"arg\":{}}"
  return code: 1
  working dir: <default: /home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~pip~pip_311_torch_linux_x86_64>
  timeout: 600
  environment:
PYTHONPATH="/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__build:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__click:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__colorama:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__importlib_metadata:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__installer:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__more_itertools:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__packaging:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__pep517:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__pip:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__pip_tools:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__pyproject_hooks:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__setuptools:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__tomli:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__wheel:/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~internal_deps~pypi__zipp"
CPPFLAGS="-isystem /home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~python~python_3_11_host/include/python3.11"
===== stdout start =====
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cpu
===== stdout end =====
===== stderr start =====
ERROR: Could not find a version that satisfies the requirement torch==2.4.1+cpu (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 2.5.0, 2.5.1)
ERROR: No matching distribution found for torch==2.4.1+cpu
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/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~/python/private/pypi/whl_installer/wheel_installer.py", line 205, in <module>
    main()
  File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~/python/private/pypi/whl_installer/wheel_installer.py", line 190, in main
    subprocess.run(pip_args, check=True, env=env)
  File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~python~python_3_11_aarch64-unknown-linux-gnu/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python~~python~python_3_11_host/python', '-m', 'pip', '--isolated', 'wheel', '--no-deps', '--index-url', 'https://pypi.org/simple', '--extra-index-url', 'https://download.pytorch.org/whl/cpu', '-r', '/tmp/tmprruvzh7j']' returned non-zero exit status 1.
===== stderr end =====

Is this a regression?

This was caused by this default flip: daed352

Related to https://github.com/bazelbuild/rules_python/issues/keith

Currently @ HEAD you have to revert the root cause of #2446 to repro this issue

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions