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

Running setup script runs into multiple issues if Python 2 isn't setup as Path env var #2595

Closed
joncwong opened this issue Jun 28, 2019 · 3 comments

Comments

@joncwong
Copy link

Just wanted to raise awareness (and am willing to help clarify this in the docs), but potential contributors are not allowed to properly run the /tools/setup.py script if Python 2 isn't set as the Path environment variable. Currently, I have Python 3 set as my default Python. Here are multiple methods I tried to work around the Python 2 requirement:

Method 1: Running python2 tools/setup.py

Within deno/third_party/depot_tools/download_from_google_storage.py, the line #!/usr/bin/python enforces the Path environment variable to be Python 2, which is ultimately the reason why it crashes and fails the setup in this case.

Method 2: Using a virtualenv with Python 2 as the chosen interpreter

Using a virtualenv solves the above issue but eventually runs into its own problems with the chromium scripts.

Here's the logs/stack trace from this particular error:

0> Failed to fetch file gs://chromium-gn/d43122f6140d0711518aa909980cb009c4fbce3d for /Users/jon/git/deno/third_party/v8/buildtools/mac/gn, skipping. [Err: [E2019-06-28T00:59:01.832918-07:00 60767 0 annotate.go:242] goroutine 1:
[E2019-06-28T00:59:01.832947-07:00 60767 0 annotate.go:242] #0 go.chromium.org/luci/vpython/python/find.go:88 - python.Find()
[E2019-06-28T00:59:01.832957-07:00 60767 0 annotate.go:242]   annotation #0:
[E2019-06-28T00:59:01.832967-07:00 60767 0 annotate.go:242]     reason: no Python found
[E2019-06-28T00:59:01.832973-07:00 60767 0 annotate.go:242]   annotation #1:
[E2019-06-28T00:59:01.832978-07:00 60767 0 annotate.go:242]     reason: failed to get version for: "/Users/jon/anaconda3/bin/python"
[E2019-06-28T00:59:01.832985-07:00 60767 0 annotate.go:242]   annotation #2:
[E2019-06-28T00:59:01.832991-07:00 60767 0 annotate.go:242]     reason: failed to parse version from: "3.6.8 :: Anaconda, Inc."
[E2019-06-28T00:59:01.832997-07:00 60767 0 annotate.go:242]   annotation #3:
[E2019-06-28T00:59:01.833002-07:00 60767 0 annotate.go:242]     reason: non-canonical Python version string: "3.6.8 :: Anaconda, Inc."
[E2019-06-28T00:59:01.833009-07:00 60767 0 annotate.go:242]
[E2019-06-28T00:59:01.833015-07:00 60767 0 annotate.go:242] #1 go.chromium.org/luci/vpython/venv/config.go:265 - venv.(*Config).resolvePythonInterpreter()
[E2019-06-28T00:59:01.833026-07:00 60767 0 annotate.go:242]   reason: could not find Python for:
[E2019-06-28T00:59:01.833034-07:00 60767 0 annotate.go:242]
[E2019-06-28T00:59:01.833039-07:00 60767 0 annotate.go:242] #2 go.chromium.org/luci/vpython/venv/config.go:187 - venv.(*Config).makeEnv()
[E2019-06-28T00:59:01.833045-07:00 60767 0 annotate.go:242]   reason: failed to resolve system Python interpreter
[E2019-06-28T00:59:01.833053-07:00 60767 0 annotate.go:242]
[E2019-06-28T00:59:01.833059-07:00 60767 0 annotate.go:242] #3 go.chromium.org/luci/vpython/venv/venv.go:163 - venv.With()
[E2019-06-28T00:59:01.833064-07:00 60767 0 annotate.go:242] #4 go.chromium.org/luci/vpython/run.go:63 - vpython.Run()
[E2019-06-28T00:59:01.833070-07:00 60767 0 annotate.go:242] #5 go.chromium.org/luci/vpython/application/application.go:318 - application.(*application).mainImpl()
[E2019-06-28T00:59:01.833078-07:00 60767 0 annotate.go:242] #6 go.chromium.org/luci/vpython/application/application.go:402 - application.(*Config).Main.func1()
[E2019-06-28T00:59:01.833086-07:00 60767 0 annotate.go:242] #7 go.chromium.org/luci/vpython/application/support.go:47 - application.run()
[E2019-06-28T00:59:01.833092-07:00 60767 0 annotate.go:242] #8 go.chromium.org/luci/vpython/application/application.go:401 - application.(*Config).Main()
[E2019-06-28T00:59:01.833098-07:00 60767 0 annotate.go:242] #9 vpython/main.go:93 - main.mainImpl()
[E2019-06-28T00:59:01.833104-07:00 60767 0 annotate.go:242] #10 vpython/main.go:99 - main.main()
[E2019-06-28T00:59:01.833110-07:00 60767 0 annotate.go:242] #11 runtime/proc.go:198 - runtime.main()
[E2019-06-28T00:59:01.833116-07:00 60767 0 annotate.go:242] #12 runtime/asm_amd64.s:2361 - runtime.goexit()
]
Failed to fetch file gs://chromium-gn/d43122f6140d0711518aa909980cb009c4fbce3d for /Users/jon/git/deno/third_party/v8/buildtools/mac/gn. [Err: [E2019-06-28T00:59:01.832918-07:00 60767 0 annotate.go:242] goroutine 1:
[E2019-06-28T00:59:01.832947-07:00 60767 0 annotate.go:242] #0 go.chromium.org/luci/vpython/python/find.go:88 - python.Find()
[E2019-06-28T00:59:01.832957-07:00 60767 0 annotate.go:242]   annotation #0:
[E2019-06-28T00:59:01.832967-07:00 60767 0 annotate.go:242]     reason: no Python found
[E2019-06-28T00:59:01.832973-07:00 60767 0 annotate.go:242]   annotation #1:
[E2019-06-28T00:59:01.832978-07:00 60767 0 annotate.go:242]     reason: failed to get version for: "/Users/jon/anaconda3/bin/python"
[E2019-06-28T00:59:01.832985-07:00 60767 0 annotate.go:242]   annotation #2:
[E2019-06-28T00:59:01.832991-07:00 60767 0 annotate.go:242]     reason: failed to parse version from: "3.6.8 :: Anaconda, Inc."
[E2019-06-28T00:59:01.832997-07:00 60767 0 annotate.go:242]   annotation #3:
[E2019-06-28T00:59:01.833002-07:00 60767 0 annotate.go:242]     reason: non-canonical Python version string: "3.6.8 :: Anaconda, Inc."
[E2019-06-28T00:59:01.833009-07:00 60767 0 annotate.go:242]
[E2019-06-28T00:59:01.833015-07:00 60767 0 annotate.go:242] #1 go.chromium.org/luci/vpython/venv/config.go:265 - venv.(*Config).resolvePythonInterpreter()
[E2019-06-28T00:59:01.833026-07:00 60767 0 annotate.go:242]   reason: could not find Python for:
[E2019-06-28T00:59:01.833034-07:00 60767 0 annotate.go:242]
[E2019-06-28T00:59:01.833039-07:00 60767 0 annotate.go:242] #2 go.chromium.org/luci/vpython/venv/config.go:187 - venv.(*Config).makeEnv()
[E2019-06-28T00:59:01.833045-07:00 60767 0 annotate.go:242]   reason: failed to resolve system Python interpreter
[E2019-06-28T00:59:01.833053-07:00 60767 0 annotate.go:242]
[E2019-06-28T00:59:01.833059-07:00 60767 0 annotate.go:242] #3 go.chromium.org/luci/vpython/venv/venv.go:163 - venv.With()
[E2019-06-28T00:59:01.833064-07:00 60767 0 annotate.go:242] #4 go.chromium.org/luci/vpython/run.go:63 - vpython.Run()
[E2019-06-28T00:59:01.833070-07:00 60767 0 annotate.go:242] #5 go.chromium.org/luci/vpython/application/application.go:318 - application.(*application).mainImpl()
[E2019-06-28T00:59:01.833078-07:00 60767 0 annotate.go:242] #6 go.chromium.org/luci/vpython/application/application.go:402 - application.(*Config).Main.func1()
[E2019-06-28T00:59:01.833086-07:00 60767 0 annotate.go:242] #7 go.chromium.org/luci/vpython/application/support.go:47 - application.run()
[E2019-06-28T00:59:01.833092-07:00 60767 0 annotate.go:242] #8 go.chromium.org/luci/vpython/application/application.go:401 - application.(*Config).Main()
[E2019-06-28T00:59:01.833098-07:00 60767 0 annotate.go:242] #9 vpython/main.go:93 - main.mainImpl()
[E2019-06-28T00:59:01.833104-07:00 60767 0 annotate.go:242] #10 vpython/main.go:99 - main.main()
[E2019-06-28T00:59:01.833110-07:00 60767 0 annotate.go:242] #11 runtime/proc.go:198 - runtime.main()
[E2019-06-28T00:59:01.833116-07:00 60767 0 annotate.go:242] #12 runtime/asm_amd64.s:2361 - runtime.goexit()
]

This might just be an isolated issue, but if it's an actual issue, then I'm happy to take this on and update the docs.

@hayd
Copy link
Contributor

hayd commented Jun 28, 2019

The anaconda Python version parsing issue has been fixed upstream in Luci go... Maybe v8 doesn't have that yet? I thought this had been working for me (I use anaconda).

At the moment users have to ensure python points to python2. You could instead pass PATH to setup.py...

This feels like a bug in v8 scripts, that they should use sys.executable rather than hardcode 'python'.

What steps are you using for virtual env?
I use conda's source activate py27..

@ry
Copy link
Member

ry commented Sep 9, 2019

Python 3 is not supported #2893

@ry ry closed this as completed Sep 9, 2019
@hayd
Copy link
Contributor

hayd commented Sep 9, 2019

The issue is actually that anaconda python2 is not supported (it is upstream, perhaps unreleased?, in Luci go). So in a future release this will work, but for now you'll need to use system python (2). Note this is only for setup.py, once this has been run anaconda python2 works fine for build.

Edit: oh, I see I said this above. The point is this isn't a python 2/3 issue. There might be a one line fix to support anaconda (prior to the upstream luci go fix). Edit: Er, not so trivial actually, hopefully v8 will update their luci-go soon.

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

No branches or pull requests

3 participants