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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip.parse
crashes with StopIteration
if platform restriction prevents package from install
#1868
Comments
As a workaround, one can exclude that specific requirement from the |
Given that colorama should be only included on Windows and you run this error on non Windows, I suspect that you are trying to cross-compile, or you are trying to use colorama without including it in your lock file, which should alter the conditional inclusion of the wheel from only on Windows to all platforms. We at work use a similar lockfile without any issues with rules_python 0.31, so I am perplexed why this is not working in your case. |
We switched to platform-agnostic lockfile (meaning that you can use this same lockfile on many platforms, it has all the needed info and all markers). Consider that we have such lines in it
we are running this on linux x86_64 and run into
I think one way to fix it would be to add code along the lines of result_lines = []
for line in lines:
r = packaging.requirements.Requirement(line)
if r.marker:
if not r.marker.evaluate():
# if we have marker and it's not for our platform of interest, skip
continue
result_lines.append(line + "\n") |
After a little bit of thinking I think the problem is that supporting cross-platform requirements would be something that detracts us from supporting other up and coming or existing cross-platform formats (e.g. I proposed a change in #1885 to unblock people needed different versions per Technically there is no parser of |
This PR implements a better way of specifying the requirements files for different (os, cpu) tuples. It allows for more granular specification than what is available today and allows for future extension to have all of the sources in the select statements in the hub repository. This is replacing the previous selection of the requirements and there are a few differences in behaviour that should not be visible to the external user. Instead of selecting the right file which we should then use to create `whl_library` instances we parse all of the provided requirements files and merge them based on the contents. The merging is done based on the blocks within the requirement file and this allows the starlark code to understand if we are working with different versions of the same package on different target platforms. Fixes #1868 Work towards #1643, #735
@aignas I just tested commit a6cb620 against my project, but it doesn't fix the issue. The problem I have is that I can't really modify the |
馃悶 bug report
Affected Rule
The issue is caused by the
pip.parse
extension.Is this a regression?
No.
Description
If the given requirement has a platform restriction like
platform_system == "Windows"
andpip
refuses to download the requirements, then Bazel will crash.馃敩 Minimal Reproduction
https://github.com/sin-ack/rules_python-repro
馃敟 Exception or Error
馃實 Your Environment
Operating System:
Output of
bazel version
:Rules_python version:
Anything else relevant?
I'm using rules_python_poetry, which generates that verbose requirement line.
The text was updated successfully, but these errors were encountered: