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

virtualenv==20.0.6 breaks pre-commit hook installation #1283

Closed
shosca opened this issue Feb 26, 2020 · 4 comments
Closed

virtualenv==20.0.6 breaks pre-commit hook installation #1283

shosca opened this issue Feb 26, 2020 · 4 comments
Labels
T: bug Something isn't working

Comments

@shosca
Copy link

shosca commented Feb 26, 2020

Describe the bug
pre-commit hook virtualenv installation fails:

❯ docker build .                                                                                                                                                                                                                                                                                                                                                             Sending build context to Docker daemon  39.94kB
Step 1/5 : FROM python:3.8                                                                                                                                                                                                                                                                                                                                                    ---> efdecc2e377a                                                                                                                                                                                                                                                                                                                                                           Step 2/5 : WORKDIR /code                                                                                                                                                                                                                                                                                                                                                      ---> Using cache
 ---> 8a15c6aceb6b                                                                                                                                                                                                                                                                                                                                                           Step 3/5 : COPY .pre-commit-config.yaml /code                                                                                                                                                                                                                                                                                                                                 ---> Using cache                                                                                                                                                                                                                                                                                                                                                             ---> 71212226c81f
Step 4/5 : RUN pip install pre-commit #"virtualenv<20.0.6"
 ---> Using cache
 ---> 7066cf6ec7a7
Step 5/5 : RUN git init && pre-commit install-hooks
 ---> Running in 4a267bf3ad20
Initialized empty Git repository in /code/.git/
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/bin/python', '/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/bin/pip', 'install', '.')
return code: 1
expected return code: 0
stdout:
    Processing /root/.cache/pre-commit/repo3n2l47dt
      Installing build dependencies: started
      Installing build dependencies: finished with status 'done'
      Getting requirements to build wheel: started
      Getting requirements to build wheel: finished with status 'done'
        Preparing wheel metadata: started
        Preparing wheel metadata: finished with status 'error'

stderr:
        ERROR: Command errored out with exit status 1:
         command: /root/.cache/pre-commit/repo3n2l47dt/py_env-python3/bin/python /root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpfyf3jze9
             cwd: /tmp/pip-req-build-zap8gmaa
        Complete output (40 lines):
        /root/.cache/pre-commit/repo3n2l47dt/py_env-python3/bin/python: No module named pip
        Traceback (most recent call last):
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
            subprocess.check_call(cmd)
          File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call
            raise CalledProcessError(retcode, cmd)
        subprocess.CalledProcessError: Command '['/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpy7yod92e', '--quiet', 'setuptools_scm']' returned non-zero exit status 1.

        During handling of the above exception, another exception occurred:

        Traceback (most recent call last):
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
            main()
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 110, in prepare_metadata_for_build_wheel
            return hook(metadata_directory, config_settings)
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/setuptools/build_meta.py", line 158, in prepare_metadata_for_build_wheel
            self.run_setup()
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/setuptools/build_meta.py", line 143, in run_setup
            exec(compile(code, __file__, 'exec'), locals())
          File "setup.py", line 18, in <module>
            setup(
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/setuptools/__init__.py", line 143, in setup
            _install_setup_requires(attrs)
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/setuptools/__init__.py", line 138, in _install_setup_requires
            dist.fetch_build_eggs(dist.setup_requires)
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/setuptools/dist.py", line 718, in fetch_build_eggs
            resolved_dists = pkg_resources.working_set.resolve(
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 781, in resolve
            dist = best[req.key] = env.best_match(
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1066, in best_match
            return self.obtain(req, installer)
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1078, in obtain
            return installer(requirement)
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
            return fetch_build_egg(self, req)
          File "/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
            raise DistutilsError(str(e))
        distutils.errors.DistutilsError: Command '['/root/.cache/pre-commit/repo3n2l47dt/py_env-python3/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpy7yod92e', '--quiet', 'setuptools_scm']' returned non-zero exit status 1.
        ----------------------------------------
    ERROR: Command errored out with exit status 1: /root/.cache/pre-commit/repo3n2l47dt/py_env-python3/bin/python /root/.cache/pre-commit/repo3n2l47dt/py_env-python3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpfyf3jze9 Check the logs for full command output.

Check the log at /root/.cache/pre-commit/pre-commit.log
The command '/bin/sh -c git init && pre-commit install-hooks' returned a non-zero code: 1

To Reproduce Steps to reproduce the behavior:

Dockerfile to reproduce:

FROM python:3.8

WORKDIR /code

COPY .pre-commit-config.yaml /code

RUN pip install pre-commit

RUN git init && pre-commit install-hooks

and .pre-commit-config.yaml:

---
- repo: https://github.com/psf/black
  rev: 19.10b0
  hooks:
  - id: black
    language_version: python3

pinning "virtualenv<20.0.6" fixes the issue

Expected behavior
pre-commit hook virtualenv installation successful

Environment (please complete the following information):
Docker python:3.8

Does this bug also happen on master?
Yes

@shosca shosca added the T: bug Something isn't working label Feb 26, 2020
@bzamecnik
Copy link

bzamecnik commented Feb 26, 2020

Also happens for me. Installing black from source in a virtualenv fails for pip 19 and 20, but works for pip 18.1. But even with pip 18.1 it fails within pre-commit virtualenv. It fails regardless of virtualenv version (20.0.6, 20.0.5, 16.7.10).

@bzamecnik
Copy link

bzamecnik commented Feb 26, 2020

Upstream bugs:

@gaborbernat
Copy link
Contributor

For now side-step the issue in virtualenv, by reverting our fix - https://virtualenv.pypa.io/en/latest/changelog.html#v20-0-7-2020-02-26

@zsol
Copy link
Collaborator

zsol commented Feb 26, 2020

Closing this as it's no longer a problem with the most recent virtualenv release (20.0.7). Thanks for the report

@zsol zsol closed this as completed Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants