rules_node icon indicating copy to clipboard operation
rules_node copied to clipboard

Be specific about the major version of python

Open alexmv opened this issue 6 years ago • 5 comments

Fixes livegrep/livegrep#136 -- or I believe it should.

alexmv avatar Dec 28 '17 19:12 alexmv

Noooope, too quick a search/replace, this clearly can't help. Let me dig a little deeper.

alexmv avatar Dec 28 '17 19:12 alexmv

AFAICT py_binary should always get a python2 unless one asks otherwise, and the command is invoked by Bazel itself.

But bazel build //node/tools/npm:install indeed produces a bazel-bin/node/tools/npm/install which starts with #!/usr/bin/env python which assumes straddling code. Color me confused.

alexmv avatar Dec 28 '17 19:12 alexmv

Ah -- it's not the shebang line on that, it's the PYTHON_BINARY = 'python' line that Bazel generates.

@francolamping, a workaround would be to pass --python_path=$(which python2.7) to your Bazel invocation.

alexmv avatar Dec 28 '17 20:12 alexmv

An alternative fix could be to update tools/npm/install so that it's python 2 and 3 compatible. What do you think about that?

samertm avatar Dec 28 '17 20:12 samertm

@alexmv the workaround worked, thanks! Funny that it didn't work before even inside a virtualenv2

francolamping avatar Dec 28 '17 20:12 francolamping