pre-commit-hooks icon indicating copy to clipboard operation
pre-commit-hooks copied to clipboard

pre-commit failed

Open whm2015 opened this issue 8 years ago • 3 comments

[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: Command: ('/usr/bin/python', '-m', 'virtualenv', '/data/home/wanghuimin/.cache/pre-commit/repooNH01N/py_env-python2.7', '-p', 'python2.7')
Return code: 1
Expected return code: 0
Output:
    New python executable in /data/home/wanghuimin/.cache/pre-commit/repooNH01N/py_env-python2.7/bin/python2.7
    Also creating executable in /data/home/wanghuimin/.cache/pre-commit/repooNH01N/py_env-python2.7/bin/python
    Installing setuptools, pip, wheel...
      Complete output from command /data/home/wanghuimi...hon2.7/bin/python2.7 - setuptools pip wheel:
      Traceback (most recent call last):
      File "<stdin>", line 7, in <module>
      File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 21, in <module>
      File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/requests/__init__.py", line 62, in <module>
      File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
    ImportError: No module named urllib3
    ----------------------------------------
    ...Installing setuptools, pip, wheel...done.
    Running virtualenv with interpreter /data/home/wanghuimin/miniconda2/envs/xcf/bin/python2.7

Errors:
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2328, in <module>
        main()
      File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 713, in main
        symlink=options.symlink)
      File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 945, in create_environment
        download=download,
      File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 901, in install_wheel
        call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
      File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 797, in call_subprocess
        % (cmd_desc, proc.returncode))
    OSError: Command /data/home/wanghuimi...hon2.7/bin/python2.7 - setuptools pip wheel failed with error code 1

when I git commit ,then comes that I can't understand the message ,can someone help? thanks

whm2015 avatar Feb 08 '18 10:02 whm2015

From some googling, this appears to be a poor interaction between virtualenv and conda -- this SO post seems to have some solutions

Our suggestion is to point pre-commit at non-conda pythons as virtualenv doesn't play quite nicely for "reasons".

asottile avatar Feb 08 '18 16:02 asottile

Thank you very much! I changed the $PATH and then it successed! Thanks~

whm2015 avatar Feb 09 '18 11:02 whm2015

Awesome! Thanks for the issue :)

asottile avatar Feb 09 '18 15:02 asottile