pre-commit: shutil.Error while installing hooks (alpine docker, musl)

We are moving to docker based CI and I’m trying to build a pre-commit testing container that is pre-populated with our hooks. Could you help me diagnose the cause of this failure? When the hooks try to install I get:

Initialized empty Git repository in /root/pre-commit/.git/
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.git.
[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: ('/root/.cache/pre-commit/repojfihsrn1/py_env-python3.5/bin/python3.5', '/root/.cache/pre-commit/repojfihsrn1/py_env-python3.5/bin/pip', 'install', '.')
Return code: 2
Expected return code: 0
Output:
    Processing /root/.cache/pre-commit/repojfihsrn1

Stack trace attached github-issue-655-trace.txt

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 22 (15 by maintainers)

Most upvoted comments

Thanks @asottile 🤞 And I agree with @FatherShawn: you’re the 💥

@hectorv I’ve been trying to get the python devs to review my change without luck: https://github.com/python/cpython/pull/4783

I ran into this today on our Python 3 + Alpine projects. Unfortunately, the mandate from above is more Python 3 and more Alpine… 🗻

Nice, I have it reproducing with this dockerfile:

FROM alpine
RUN apk update && apk add curl git python3

RUN git clone https://github.com/pre-commit/pre-commit-hooks /pre-commit-hooks
WORKDIR /pre-commit-hooks

ENV PATH="/venv/bin:$PATH"
RUN curl https://asottile.github.io/get-virtualenv.py | python3 - /venv && \
    pip install pre-commit

CMD ["pre-commit", "run", "--all-files"]

And output:

$ docker build -t test . && docker run testSending build context to Docker daemon  2.048kB
Step 1/7 : FROM alpine
 ---> 37eec16f1872
Step 2/7 : RUN apk update && apk add curl git python3
 ---> Using cache
 ---> 6949406e9ea3
Step 3/7 : RUN git clone https://github.com/pre-commit/pre-commit-hooks /pre-commit-hooks
 ---> Using cache
 ---> 71271e0f0542
Step 4/7 : WORKDIR /pre-commit-hooks
 ---> Using cache
 ---> 83a333b5a457
Step 5/7 : ENV PATH "/venv/bin:$PATH"
 ---> Using cache
 ---> aef6cd420baa
Step 6/7 : RUN curl https://asottile.github.io/get-virtualenv.py | python3 - /venv &&     pip install pre-commit
 ---> Using cache
 ---> 07990b9c25f0
Step 7/7 : CMD pre-commit run --all-files
 ---> Using cache
 ---> cbccd5cd7af5
Successfully built cbccd5cd7af5
Successfully tagged test:latest
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[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/repo054dsazs/py_env-python3/bin/python3', '/root/.cache/pre-commit/repo054dsazs/py_env-python3/bin/pip', 'install', '.')
Return code: 2
Expected return code: 0
Output: 
    Processing /root/.cache/pre-commit/repo054dsazs
    
Errors: 
    Exception:
    Traceback (most recent call last):
      File "/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/site-packages/pip/commands/install.py", line 335, in run
        wb.build(autobuilding=True)
      File "/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/site-packages/pip/wheel.py", line 749, in build
        self.requirement_set.prepare_files(self.finder)
      File "/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
        ignore_dependencies=self.ignore_dependencies))
      File "/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/site-packages/pip/req/req_set.py", line 620, in _prepare_file
        session=self.session, hashes=hashes)
      File "/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/site-packages/pip/download.py", line 809, in unpack_url
        unpack_file_url(link, location, download_dir, hashes=hashes)
      File "/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/site-packages/pip/download.py", line 686, in unpack_file_url
        shutil.copytree(link_path, location, symlinks=True)
      File "/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/shutil.py", line 359, in copytree
        raise Error(errors)
    shutil.Error: [('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/bisect.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/bisect.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/bisect.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/io.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/io.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/io.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/base64.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/base64.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/base64.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/tempfile.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/tempfile.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/tempfile.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/_bootlocale.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/_bootlocale.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/_bootlocale.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/importlib', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/importlib', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/importlib'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/copy.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/copy.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/copy.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/warnings.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/warnings.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/warnings.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/__future__.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/__future__.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/__future__.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/tokenize.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/tokenize.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/tokenize.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/genericpath.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/genericpath.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/genericpath.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/reprlib.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/reprlib.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/reprlib.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/fnmatch.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/fnmatch.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/fnmatch.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/sre_constants.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/sre_constants.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/sre_constants.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/collections', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/collections', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/collections'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/hashlib.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/hashlib.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/hashlib.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/heapq.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/heapq.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/heapq.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/distutils', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/distutils', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/distutils'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/encodings', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/encodings', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/encodings'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/random.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/random.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/random.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/copyreg.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/copyreg.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/copyreg.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/weakref.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/weakref.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/weakref.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/sre_parse.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/sre_parse.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/sre_parse.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/imp.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/imp.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/imp.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/codecs.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/codecs.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/codecs.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/operator.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/operator.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/operator.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/os.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/os.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/os.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/keyword.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/keyword.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/keyword.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/_weakrefset.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/_weakrefset.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/_weakrefset.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/posixpath.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/posixpath.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/posixpath.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/hmac.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/hmac.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/hmac.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/functools.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/functools.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/functools.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/shutil.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/shutil.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/shutil.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/abc.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/abc.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/abc.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/__pycache__', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/__pycache__', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/__pycache__'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/stat.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/stat.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/stat.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/token.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/token.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/token.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/rlcompleter.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/rlcompleter.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/rlcompleter.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/ntpath.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/ntpath.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/ntpath.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/sre_compile.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/sre_compile.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/sre_compile.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/config-3.6m-x86_64-linux-gnu', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/config-3.6m-x86_64-linux-gnu', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/config-3.6m-x86_64-linux-gnu'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/_dummy_thread.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/_dummy_thread.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/_dummy_thread.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/struct.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/struct.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/struct.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/types.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/types.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/types.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/tarfile.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/tarfile.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/tarfile.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/re.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/re.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/re.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/locale.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/locale.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/locale.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/_collections_abc.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/_collections_abc.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/_collections_abc.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/linecache.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/linecache.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/linecache.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/lib-dynload', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/lib-dynload', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/lib-dynload'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/lib/python3.6/enum.py', '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/enum.py', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/lib/python3.6/enum.py'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/bin/python', '/tmp/pip-6y6bwd6i-build/py_env-python3/bin/python', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/bin/python'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/bin/python3.6', '/tmp/pip-6y6bwd6i-build/py_env-python3/bin/python3.6', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/bin/python3.6'"), ('/root/.cache/pre-commit/repo054dsazs/py_env-python3/include/python3.6m', '/tmp/pip-6y6bwd6i-build/py_env-python3/include/python3.6m', "[Errno 95] Not supported: '/tmp/pip-6y6bwd6i-build/py_env-python3/include/python3.6m'")]
    

Check the log at /root/.cache/pre-commit/pre-commit.log