New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 824968 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

FR: Make vpython behave better in the presence of nonstandard python version strings (e.g. anaconda's)

Project Member Reported by hzl@chromium.org, Mar 22 2018

Issue description

Here is the log:

mb_validate (0.07s) failed
[E2018-03-22T14:08:52.700182-07:00 228271 0 annotate.go:242] goroutine 1:
[E2018-03-22T14:08:52.700214-07:00 228271 0 annotate.go:242] #0 go.chromium.org/luci/vpython/python/find.go:88 - python.Find()
[E2018-03-22T14:08:52.700233-07:00 228271 0 annotate.go:242]   annotation #0:
[E2018-03-22T14:08:52.700248-07:00 228271 0 annotate.go:242]     reason: no Python found
[E2018-03-22T14:08:52.700261-07:00 228271 0 annotate.go:242]   annotation #1:
[E2018-03-22T14:08:52.700273-07:00 228271 0 annotate.go:242]     reason: failed to get version for: "/usr/local/google/home/hzl/anaconda2/bin/python2.7"
[E2018-03-22T14:08:52.700285-07:00 228271 0 annotate.go:242]   annotation #2:
[E2018-03-22T14:08:52.700292-07:00 228271 0 annotate.go:242]     reason: failed to parse version from: "2.7.14 :: Anaconda, Inc."
[E2018-03-22T14:08:52.700300-07:00 228271 0 annotate.go:242]   annotation #3:
[E2018-03-22T14:08:52.700306-07:00 228271 0 annotate.go:242]     reason: non-canonical Python version string: "2.7.14 :: Anaconda, Inc."
[E2018-03-22T14:08:52.700313-07:00 228271 0 annotate.go:242] 
[E2018-03-22T14:08:52.700322-07:00 228271 0 annotate.go:242] #1 go.chromium.org/luci/vpython/venv/config.go:265 - venv.(*Config).resolvePythonInterpreter()
[E2018-03-22T14:08:52.700329-07:00 228271 0 annotate.go:242]   reason: could not find Python for: 2.7.0
[E2018-03-22T14:08:52.700341-07:00 228271 0 annotate.go:242] 
[E2018-03-22T14:08:52.700348-07:00 228271 0 annotate.go:242] #2 go.chromium.org/luci/vpython/venv/config.go:187 - venv.(*Config).makeEnv()
[E2018-03-22T14:08:52.700355-07:00 228271 0 annotate.go:242]   reason: failed to resolve system Python interpreter
[E2018-03-22T14:08:52.700365-07:00 228271 0 annotate.go:242] 
[E2018-03-22T14:08:52.700373-07:00 228271 0 annotate.go:242] #3 go.chromium.org/luci/vpython/venv/venv.go:150 - venv.With()
[E2018-03-22T14:08:52.700383-07:00 228271 0 annotate.go:242]   reason: failed to initialize empty probe environment
[E2018-03-22T14:08:52.700391-07:00 228271 0 annotate.go:242] 
[E2018-03-22T14:08:52.700398-07:00 228271 0 annotate.go:242] #4 go.chromium.org/luci/vpython/run.go:63 - vpython.Run()
[E2018-03-22T14:08:52.700406-07:00 228271 0 annotate.go:242] #5 go.chromium.org/luci/vpython/application/application.go:318 - application.(*application).mainImpl()
[E2018-03-22T14:08:52.700416-07:00 228271 0 annotate.go:242] #6 go.chromium.org/luci/vpython/application/application.go:402 - application.(*Config).Main.func1()
[E2018-03-22T14:08:52.700427-07:00 228271 0 annotate.go:242] #7 go.chromium.org/luci/vpython/application/support.go:47 - application.run()
[E2018-03-22T14:08:52.700435-07:00 228271 0 annotate.go:242] #8 go.chromium.org/luci/vpython/application/application.go:401 - application.(*Config).Main()
[E2018-03-22T14:08:52.700443-07:00 228271 0 annotate.go:242] #9 vpython/main.go:92 - main.mainImpl()
[E2018-03-22T14:08:52.700454-07:00 228271 0 annotate.go:242] #10 vpython/main.go:98 - main.main()
[E2018-03-22T14:08:52.700474-07:00 228271 0 annotate.go:242] #11 runtime/proc.go:195 - runtime.main()
[E2018-03-22T14:08:52.700482-07:00 228271 0 annotate.go:242] #12 runtime/asm_amd64.s:2337 - runtime.goexit()


vpython/python/find.go does not recognize Anaconda python when I tried to do git cl upload. After changing the path of python, I am able to upload. But it might be useful to make the script a bit smarter to parse version from: "2.7.14 :: Anaconda, Inc."
 

Comment 1 by d...@chromium.org, Mar 22 2018

Cc: d...@chromium.org
Owner: iannucci@chromium.org
Sorry, I can't own this, since I'm not on Chromium team anymore. Passing to iannucci@ for triage.
We shouldn't blend anaconda python with vpython... can I get some more context on where this is happening?
It looks like you're running a custom python... My first piece of advice would be "don't run a custom python" :)
Components: Infra>Platform
Labels: -Type-Bug Type-Feature
Summary: FR: Consider making vpython compatible with anaconda python (was: vpython/python/find.go does not recognize Anaconda python)
Re-titling this as a feature request. 

My instinct is that this is a bad idea anyway. The purpose of anaconda is to get a big pile of dependencies bundled up into a giant pre-distributed package. The purpose of vpython is to express individual package dependencies explicitly.

However, it might be worthwhile to investigate to see if this is vpython breaking itself prematurely instead of just skipping the python with a bad version string.

Comment 5 by hzl@chromium.org, Mar 22 2018

Thanks for looking @iannucci. I will keep using the default python.
Cc: iannucci@chromium.org
Owner: ----
Status: Available (was: Untriaged)
Summary: FR: Make vpython behave better in the presence of nonstandard python version strings (e.g. anaconda's) (was: FR: Consider making vpython compatible with anaconda python )

Comment 7 by d...@chromium.org, Apr 16 2018

FWIW, vpython's version parsing is generally forgiving: https://chromium.googlesource.com/infra/luci/luci-go/+/master/vpython/python/version.go#26

It sucks that Anaconda's version string doesn't conform to PEP440 :/ AFAICT the only thing we can do here is have a failure mode where vpython says "if I can't understand the version, just assume it's whatever I was looking for". However, that will be problematic if we start using it to differentiate Python3 specs from Python2.

Another option is to have it fall back to some pretty resilient logic:

1) Remove all characters that aren't numbers or dots.
2) Parse it left-to-right until it gets 1, 2, or 3 dot-delimited numbers.

This would work basically everywhere. Actually now that I think about it, this is not a bad thing to try.
Cc: iannu...@google.com
Cc: -iannucci@chromium.org

Sign in to add a comment