Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wheelinstaller does not use the archive when installing sdist #2090

Closed
chrisirhc opened this issue Jul 25, 2024 · 2 comments · Fixed by #2091
Closed

wheelinstaller does not use the archive when installing sdist #2090

chrisirhc opened this issue Jul 25, 2024 · 2 comments · Fixed by #2091
Labels
need: repro Needs a minimal reproduction

Comments

@chrisirhc
Copy link
Contributor

chrisirhc commented Jul 25, 2024

🐞 bug report

Version used: 59bb4a8
When using experimental_index_url, the index url is not respected when falling back to sdist, it is also not using the downloaded archive.

Affected Rule


INFO: Repository rules_python~~pip~third_party_python_piper_39_caesar_sdist_37026b9b instantiated at:
--
<builtin>: in <toplevel>
Repository rule whl_library defined at:
/var/cache/bazel/output_base/external/rules_python~/python/private/pypi/whl_library.bzl:451:30: in <toplevel>
ERROR: An error occurred during the fetch of repository 'rules_python~~pip~third_party_python_piper_39_caesar_sdist_37026b9b':
Traceback (most recent call last):
File "/var/cache/bazel/output_base/external/rules_python~/python/private/pypi/whl_library.bzl", line 243, column 35, in _whl_library_impl
repo_utils.execute_checked(
File "/var/cache/bazel/output_base/external/rules_python~/python/private/repo_utils.bzl", line 204, column 29, in _execute_checked
return _execute_internal(fail_on_error = True, *args, **kwargs)
File "/var/cache/bazel/output_base/external/rules_python~/python/private/repo_utils.bzl", line 135, column 20, in _execute_internal
logger.fail((
File "/var/cache/bazel/output_base/external/rules_python~/python/private/repo_utils.bzl", line 85, column 39, in lambda
fail = lambda message_cb: _log(-1, "FAIL", message_cb, fail),
File "/var/cache/bazel/output_base/external/rules_python~/python/private/repo_utils.bzl", line 75, column 16, in _log
printer("\nrules_python:{} {}:".format(
…
rules_python:whl_library(@@rules_python~~pip~third_party_python_piper_39_caesar_sdist_37026b9b) FAIL: repo.execute: whl_library.BuildWheelFromSource(rules_python~~pip~third_party_python_piper_39_caesar_sdist_37026b9b, caesar==7.0.0): end: failure:
--
command: /var/cache/bazel/output_base/external/rules_python~~python~python_3_9_host/python -m python.private.pypi.whl_installer.wheel_installer --requirement caesar==7.0.0 --isolated --extra_pip_args "{\"arg\":[]}" --pip_data_exclude "{\"arg\":[]}" --environment "{\"arg\":{}}"
return code: 1
…
  | ERROR: Could not find a version that satisfies the requirement caesar==7.0.0 (from versions: 0.1.2, 0.1.3)
-- | --
ERROR: No matching distribution found for caesar==7.0.0
…
subprocess.CalledProcessError: Command '['/var/cache/bazel/output_base/external/rules_python~~python~python_3_9_host/python', '-m', 'pip', '--isolated', 'wheel', '--no-deps', '-r', '/tmp/tmpzb5a5smh']' returned non-zero exit status 1.

The issue is caused by the rule:

The likely cause is in

args = _parse_optional_attrs(rctx, args, extra_pip_args)

Is this a regression?

Not sure.

Description

A clear and concise description of the problem...

🔬 Minimal Reproduction

  1. Setup a pypi repo and add a source distribution only such as xyz-0.1.tar.gz
  2. Run pip_parse with experimental_index_url = <local pypi index url>

(Will add a repro later)

🔥 Exception or Error





🌍 Your Environment

Operating System:

  

  

Output of bazel version:

  

  

Rules_python version:

  

  

Anything else relevant?

@chrisirhc
Copy link
Contributor Author

chrisirhc commented Jul 25, 2024

Found a potential fix #2091 , but hit a new issue:


  | ===== stdout end =====
-- | --
===== stderr start =====
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
Looking in links: .
ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
ERROR: No matching distribution found for setuptools>=40.8.0
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Traceback (most recent call last):

Command looks good now:

  | subprocess.CalledProcessError: Command '['/var/cache/bazel/output_base/external/rules_python~~python~python_3_9_host/python', '-m', 'pip', '--isolated', 'wheel', '--no-deps', '--no-index', '--find-links', '.', '-r', '/tmp/tmp8isjb37f']' returned non-zero exit status 1.
-- | --
===== stderr end =====

@aignas
Copy link
Collaborator

aignas commented Jul 25, 2024

Could you please create a minimum reproducible example?

@aignas aignas added the need: repro Needs a minimal reproduction label Jul 25, 2024
github-merge-queue bot pushed a commit that referenced this issue Jul 26, 2024
Before this PR the extra arguments added by the `experimental_index_url`
code paths were not used and the `sdist` was being redownloaded every
time
we would build from `sdist`.

This PR fixes the code to not ignore the extra args added in

https://github.com/bazelbuild/rules_python/pull/2091/files#diff-c007ed21502bf8ea19b98b3f1b402e7071615f8520e4291b00a71bca2cd451e8R231

Fixes #2090

---------

Co-authored-by: aignas <240938+aignas@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need: repro Needs a minimal reproduction
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants