-
Notifications
You must be signed in to change notification settings - Fork 183
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
pkg_zip failing on windows and embeddable python w/ Bazel 4.0.0 #475
Comments
This is a protoc build, not rules_pkg. I'm going to transfer the issue there. |
No, this is a problem with rules_pkg. I am on the protobuf team. |
We're attempting to use rules_pkg in protobuf's repo. |
OK. I took the issue back.
It's going to be hard to reproduce, since I don't have a working windows environment right now. |
Also, are other python tools working for you with your particular combination of bazel and rules_python versions? |
More things to try. |
This has nothing to do with the rules_proto repo to be clear, this is the http://github.com/protocolbuffers/protobuf repo for the Protocol Buffers project. The deps/versions of things are also checked in to GitHub here: https://github.com/protocolbuffers/protobuf/blob/master/protobuf_deps.bzl
Only Windows, linux is working as expected.
I'd suggest a simple GCP VM, this is how I've been doing diagnostics.
This is the only python tool we've introduced, thus far.
Correct, it does fail in the same way.
https://gist.github.com/perezd/1014425bfa1d0674c1269fbdcb2452ba |
Thanks for that information. I'm going to be tied up with BazelCon for the rest of the week. I can potentially try some things out next week, but that is likely to be a busy/short week because of Thanksgiving. |
I am using the embeddable package fwiw:
https://www.python.org/downloads/release/python-399/
Also, if there are any PATH things that may need to be setup, I likely
didn't set them up correctly/at all, do you have any suggestions?
…On Mon, Nov 15, 2021 at 9:21 PM aiuto ***@***.***> wrote:
Thanks for that information.
If pkg_tar fails the same way, and the *init*.py is in private, as the ls
shows, then this is a python path problem. But we are using the same
rules_python versions, and our tests pass on Windows, but yours don't, so
there is no smoking gun.
I'm going to be tied up with BazelCon for the rest of the week. I can
potentially try some things out next week, but that is likely to be a
busy/short week because of Thanksgiving.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#475 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAFA5XQI62TM33C4JQHJ23UMHS6HANCNFSM5IB27QOA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
On Tue, Nov 16, 2021 at 12:31 AM Derek Perez ***@***.***>
wrote:
I am using the embeddable package fwiw:
https://www.python.org/downloads/release/python-399/
I don't think the python version should be the problem. AFAIK, import
did not change between 3.6 and 3.9
Also, if there are any PATH things that may need to be setup, I likely
didn't set them up correctly/at all, do you have any suggestions?
There should not be anything you should have to set. Bazel is supposed to
provide a good default environment for running py_binary targets.
…On Mon, Nov 15, 2021 at 9:21 PM aiuto ***@***.***> wrote:
> Thanks for that information.
> If pkg_tar fails the same way, and the *init*.py is in private, as the ls
> shows, then this is a python path problem. But we are using the same
> rules_python versions, and our tests pass on Windows, but yours don't, so
> there is no smoking gun.
>
> I'm going to be tied up with BazelCon for the rest of the week. I can
> potentially try some things out next week, but that is likely to be a
> busy/short week because of Thanksgiving.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
#475 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAAFA5XQI62TM33C4JQHJ23UMHS6HANCNFSM5IB27QOA
>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
>
> or Android
> <
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
>.
>
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#475 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXHHHBKKZBDK6ENPLJYEKDUMHUBXANCNFSM5IB27QOA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Any updates here? |
Not yet. We Bazelcon last week and Thanksgiving this week, I have not had a chance to even look at setting up a windows environment to test in. |
OK! Let me know if I can assist when you start investigating.
…On Wed, Nov 24, 2021 at 1:17 PM aiuto ***@***.***> wrote:
Not yet. We Bazelcon last week and Thanksgiving this week, I have not had
a chance to even look at setting up a windows environment to test in.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#475 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAFA5SPPL3LWETHCZVYUSLUNVJAFANCNFSM5IB27QOA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I tried this out in a local Windows dev environment I have lying around, and the first thing I encountered was:
Reading the file where the failure occurred, it looks like only mingw builds are supported for packaging (is this intentional?). This was easy enough to work around. After doing so, the build of the zip worked fine for me. I am using HEAD protobuf, rules_pkg 0.5.1. Some differences between our environments:
Either of these may have made the difference. I currently don't have the time to investigate further, but I hope this information helps. |
That fail is in protobuf code, so I can't say if that is intentional or not, but it looks that way. This does indirectly answer the question you asked last week. "how can I help". You can find a reproduction of the problem that does not require a C++ complier. That would probably be something not trying to build protobuf. |
Can you try checking out at this commit? protocolbuffers/protobuf@4eb8840 I think you're running into some rules_pkg stuff we're setting up that's environment specific. As for the doesn't rqeuire a C++ compiler, you can simply mod the build file to not include :protoc and you'd have that repro. |
I believe I already had it, but I synced to HEAD anyway today.
I was, and was able to work around the problem OK. Apparently it was fixed in protocolbuffers/protobuf@667d5e9 nearly identically to how I fixed it locally.
I was able to build the target without MSVC by making the suggested edits. I am still not able to reproduce the problem at this time using either Bazel 4.0.0 or 4.2.1, even after syncing past the specified commit. I am still using the copy of python (3.9.9) from the MSFT store, which may be the deciding difference. There may some repository state that needs to be cleaned up ( |
One thing I mentioned earlier on in the thread is I am using the embeddable package of python for windows, found here: Perhaps its unique to this format? It's required for my use case (docker container) |
Are there any other differences in your environment that come to mind? Is there anything else special about the docker container? Do you have a global It would also be very helpful to have an automated way to reproduce this that properly emulates your environment. Would it be possible to provide one? Other notes about the environment would also be helpful; I might have time to look into this a little more over the next few days. |
Nothing unusual w/ bazelrc, just changes to output_base and repository_cache.. Also running w/
We start bazel w/ a custom entrypoint.ps1 powershell script that looks like:
Nothing special there either really. Our docker container is based on: We simply extract the embeddable python package to C:\python and add it to
|
I was able to reproduce this locally using the embedded python package you mentioned earlier. My conclusion is that this is not a bug in rules_pkg, but either something in bazel, or (IMO, more likely) your setup. You probably should not be using the embeddable python binary, since it ignores various aspects of the environment by design, according to https://bugs.python.org/issue28245 and the relevant documentation. As it stands, the embeddable python binary is not compatible with Bazel: the bazel python stub launcher uses the See also bazelbuild/bazel#7959, and the stub template itself for more details. Local analysis:
Actually running said binary in that enviornment: Python 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)] on win32
>>> import sys; sys.path
['C:\\python\\python39.zip', 'C:\\python']
>>> import os; os.environ['PYTHONPATH']
'foo' PTAL and close if you agree. |
This is an interesting thing to at least add to rules_pkg README, potentially. I'm not sure how else to get Python running in a docker container, perhaps there are other strategies I can try. Thanks for looking into this! |
Error message:
Here's the BUILD target:
https://github.com/protocolbuffers/protobuf/blob/master/BUILD#L575
Any pointers? Any other context I can provide?
Python version: 3.9.8
The text was updated successfully, but these errors were encountered: