Skip to content

pip_install Python2 support? #409

@gfl-chris

Description

@gfl-chris

🐞 bug report

Affected Rule

The issue is caused by the rule: pip_import

Is this a regression?

No. Yes. Maybe.

Description

I'm trying to invoke the pip_install workspace rule with Python2, setting python_interpreter to "python2". But pip_install fails with the error /usr/bin/python2: No module named python.pip_install. I tracked this down to missing __init__.py files in the rules_python/python and rules_python/python/pip_install directories. Python2 must require init.py files in the whole module path whereas Python3 doesn't... Anyhow, once the files are there, python2 fails with the error:

  File "python/pip_install/extract_wheels/__init__.py", line 18
    def configure_reproducible_wheels() -> None:
                                        ^
SyntaxError: invalid syntax

Which tells me that that's Python3 syntax. :( Is Python2 not supported for pip_install?

🌍 Your Environment

Output of bazel version:

  
Bazelisk version: development
Build label: 3.7.1
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Nov 24 17:38:30 2020 (1606239510)
Build timestamp: 1606239510
Build timestamp as int: 1606239510
  

Rules_python version:

  
8537cea11d867333c07c465d536778c1b7560cde
  

python2 --version:
Python 2.7.18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions