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

Figure out a good strategy for managing python version/s #16001

Open
phlax opened this issue Apr 15, 2021 · 4 comments
Open

Figure out a good strategy for managing python version/s #16001

phlax opened this issue Apr 15, 2021 · 4 comments
Assignees
Labels

Comments

@phlax
Copy link
Member

phlax commented Apr 15, 2021

description

some parts of tooling/ci require python3.8 and more generally recent python 3.x versions have syntax incompatibility

for those reasons the envoy-build-image sets python3.8 as the default interpreter

some OS dont have support for this out of the box so we could do with a good strategy for handling this

a couple of ideas in this respect are:

  • use a python_runtime bazel rule to pull in the required py version
  • explicitly set python3.8 in the shebang lines so devs can keep lower versions without having to update-alternatives or similar
  • use a venv runtime (i think this is the least prefered option for various reasons)
@phlax phlax added enhancement Feature requests. Not bugs or questions. triage Issue requires triage labels Apr 15, 2021
@mattklein123 mattklein123 added area/build help wanted Needs help! and removed enhancement Feature requests. Not bugs or questions. triage Issue requires triage labels Apr 15, 2021
@jpeach
Copy link
Contributor

jpeach commented May 10, 2021

May be related to bazelbuild/bazel#8685

@jpeach
Copy link
Contributor

jpeach commented May 18, 2021

The build requires a program named python. Using update-alternatives to point /usr/bin/python to python3 works until the thrift test, which explicitly check for python 2. IIUC most of the rest of the build and tooling wants python 3 (though it doesn't ever invoke anything with /usr/bin/python3).

I would be happy to work on improving this if there's a committer with Bazel expertise who can shepherd.

[ RUN      ] TransportsAndProtocols/ThriftTranslationIntegrationTest.Translates/FromFramedBinaryToFramedBinary
Using address /tmp/envoy_test_uds.OLGfdl/fixture.sock
Error occurred while attempting to use the default Python toolchain (@rules_python//python:autodetecting_toolchain).
According to '/usr/bin/python -V', version is 'Python 3.9.4', but we need version 2. PATH is:

.:/home/jpeach/.cache/bazelisk/downloads/bazelbuild/bazel-3.7.2-linux-x86_64/bin:/home/jpeach/bin:/home/jpeach/go/bin:/home/linuxbrew/.linuxbrew/opt/*/libexec/gnubin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/jpeach/bin:/home/jpeach/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

Please ensure an interpreter with version 2 is available on this platform as 'python2' or 'python', or else register an appropriate Python toolchain as per the documentation for py_runtime_pair (https://github.com/bazelbuild/rules_python/blob/master/docs/python.md#py_runtime_pair).

@phlax
Copy link
Member Author

phlax commented May 18, 2021

IIUC most of the rest of the build and tooling wants python 3 (though it doesn't ever invoke anything with /usr/bin/python3

there is a specific dependency on python3.8 in one of the tools - so the build image has python3.8 installed and set as the default interpreter - and the general advice is to use 3.8 or above

regarding the python2 requirement - i would hope we can update that to use a more recent version

regarding this ticket i think the best way would be to use a py_runtime bazel rule (https://docs.bazel.build/versions/master/be/python.html#py_runtime) - the more we put into bazel the less assumptions we make about the end user/devs environment and the more likely everything is to work out of the box

if you were up for taking this on @jpeach - i am happy to review etc

@jpeach
Copy link
Contributor

jpeach commented May 20, 2021

if you were up for taking this on @jpeach - i am happy to review etc

Great! I'll try to dig in to this over the next few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants