Skip to content

python_venv language fails to use python3 interpreter and is using python2.7 instead #794

@ssbarnea

Description

@ssbarnea

Apparently pre-commit failed to use python3 interpreter when I tried to add a hook and thus failed because venv module was not installed on default python2.7!

$ pre-commit try-repo ../python-license-check                                                                                                                                                                   [19:55:27]
[INFO] Initializing environment for ../python-license-check.
===============================================================================
Using config:
===============================================================================
repos:
-   repo: ../python-license-check
    rev: 4048cf3844dbbf45690c153a7da7f532585ec87c
    hooks:
    -   id: liccheck
===============================================================================
[INFO] Installing environment for ../python-license-check.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: Command: ('/Users/ssbarnea/.pyenv/versions/2.7.14/bin/python2.7', '-mvenv', '/var/folders/br/99tfdvcs3vvfwdk69z7f0xmc0000gn/T/tmpayl0P5/repoHa7_qe/py_venv-python2.7')
Return code: 1
Expected return code: 0
Output: (none)
Errors:
    /Users/ssbarnea/.pyenv/versions/2.7.14/bin/python2.7: No module named venv


Check the log at /Users/ssbarnea/.cache/pre-commit/pre-commit.log
FAIL: 1
ssbarnea@smac: ~/os/jira master ⚡ $ cat ../python-license-check/.pre-commit-hooks.yaml                                                                                                                                                            [19:55:34]
-   id: liccheck
    name: Validates dependency licenses for Python packages
    description: This validator validates a pre-commit hooks manifest file
    entry: liccheck -s setup.cfg -r requirements.txt
    language: python_venv

Based on the documentation I was expecting to see pre-commit using the python3 executable for calling venv module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions