-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Bazel's Python stub is broken on Ubuntu 20.04 LTS #11554
Comments
Probably it's a good time to add Ubuntu 20.04 to our CI after this bug is fixed. |
@meisterT Yep. I discovered it during the preparations for that 😄 |
Gerrit project would also like to use RBE with Ubuntu 20.04 image, see this request: [1]. This is needed, because Gerrit uses very recent Git core package (> 2.18) that is only available out of the box in Ubuntu 20.04. Any help with moving forward with: [1] would be greatly appreciated. Yes, I know, that we could easily create custom Ubuntu image for RBE, but a patch for that was staled: [2]. [1] bazelbuild/bazel-toolchains#870 |
+1 on this. Experiencing this as well |
This also appears to affect Debian unstable, which doesn't have the workaround packages mentioned above (python-is-python[23]) |
This also breaks Android rules.
I manually linked |
Is there a chance to get this fixed in time for Bazel 4.0 (#12455)? If not, is this something that will become part of a 4.0 LTS patch release or will it have to wait until 5.0? |
Is there a work around that during building the bazel itself, to permanently change default rule of python to invoke python3? or more generally, to use any python I want, even if it is in a non-standard path? |
The workaround I use is to add these to my
But that won't work for you if the thing you use actually requires python2 and won't work in python3. |
I see. For building bazel itself on python3-only systems I found a work around by changing file:
to
This will at least affect all scripts generated to build bazel iteself. I'm not sure if this also affects future builds. Previous build failures were caused by auto-generated scripts interpreter instruction line "#!/usr/bin/env python" |
I just burnt an hour on this problem after an Ubuntu 20.04 update. |
Had a similar issue with building in a
|
@junyer Thank you! Indeed it seems like this was fixed by the referenced PRs. :) |
- Removes deprecated managed_directories, see bazelbuild/bazel#15463 - Fixes issue with @build_bazel_rules_nodejs, see bazel-contrib/rules_nodejs#2733 (comment) - Sets test action to use Ubuntu-20.04 because it's needed for pkg_tar (bazelbuild/bazel#11554) since python2 was removed from Ubuntu after 20.04.
Sets release action to use Ubuntu-20.04 because it's needed for pkg_tar (bazelbuild/bazel#11554) since python2 was removed from Ubuntu after 20.04.
- Removes deprecated managed_directories, see bazelbuild/bazel#15463 - Fixes issue with @build_bazel_rules_nodejs, see bazel-contrib/rules_nodejs#2733 (comment) - Sets test action to use Ubuntu-20.04 because it's needed for pkg_tar (bazelbuild/bazel#11554) since python2 was removed from Ubuntu after 20.04.
Sets release action to use Ubuntu-20.04 because it's needed for pkg_tar (bazelbuild/bazel#11554) since python2 was removed from Ubuntu after 20.04.
- Removes deprecated managed_directories, see bazelbuild/bazel#15463 - Fixes issue with @build_bazel_rules_nodejs, see bazel-contrib/rules_nodejs#2733 (comment) - Sets test action to use Ubuntu-20.04 because it's needed for pkg_tar (bazelbuild/bazel#11554) since python2 was removed from Ubuntu after 20.04.
Sets release action to use Ubuntu-20.04 because it's needed for pkg_tar (bazelbuild/bazel#11554) since python2 was removed from Ubuntu after 20.04.
- Removes deprecated managed_directories, see bazelbuild/bazel#15463 - Fixes issue with @build_bazel_rules_nodejs, see bazel-contrib/rules_nodejs#2733 (comment) - Sets test action to use Ubuntu-20.04 because it's needed for pkg_tar (bazelbuild/bazel#11554) since python2 was removed from Ubuntu after 20.04.
Sets release action to use Ubuntu-20.04 because it's needed for pkg_tar (bazelbuild/bazel#11554) since python2 was removed from Ubuntu after 20.04.
Description of the problem / feature request:
Bazel's uses a Python stub to make
py_binary
targets easily runnable: https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt?q=python_stub&ss=bazelIt uses the classic shebang-line
#!/usr/bin/env python
to invoke Python. This breaks on Ubuntu 20.04 LTS, because Ubuntu no longer provides apython
executable - they only have/usr/bin/python2
and/usr/bin/python3
.This means that
py_binary
targets now fail with a message like this (from building Bazel itself on Ubuntu 20.04 LTS):Users can work around this by installing
python-is-python2
orpython-is-python3
, which will install a system-wide symlink that redirectspython
to either of the versions, but neither seem to be installed by default, so we cannot rely on users having these.What operating system are you running Bazel on?
Ubuntu 20.04 LTS
What's the output of
bazel info release
?Bazel 3.2.0
The text was updated successfully, but these errors were encountered: