预提交无法在Docker容器中运行

问题描述

我尝试在dockerized开发环境中安装pre-commit==1.20.0,只是为了允许我们手动运行pre-commit run --all-files。但是,它失败了,并且我无法破译错误。我推测作为我们的Docker容器一部分的额外索引正在触发预提交,但不确定。

这是/etc/pip.conf内容

[global]
extra-index-url=https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/

我知道这可行,因为通常我们必须调用pip install package --extra-index-url https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/ 来安装软件包,而pip.conf已成功实现并且pip install package就足够了。

我在pre-commit run --all-files上遇到的错误如下:

pre-commit run --all-files
[INFO] Installing environment for https://github.com/ambv/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: Command: ('/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/bin/python','/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/bin/pip','install','.')
Return code: 1
Expected return code: 0
Output:
    Looking in indexes: https://pypi.org/simple,https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/
    Processing /home/thomas/.cache/pre-commit/repoa3dsqwwo
      Installing build dependencies: started
      Installing build dependencies: finished with status 'error'
    User for pkgs.dev.azure.com:
Errors:
      ERROR: Command errored out with exit status 2:
       command: /home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/bin/python /home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-che1xbcz/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/ -- 'setuptools>=41.0' setuptools-scm wheel
           cwd: None
      Complete output (51 lines):
      Looking in indexes: https://pypi.org/simple,https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/,https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/
      User for pkgs.dev.azure.com: ERROR: Exception:
      Traceback (most recent call last):
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/cli/base_command.py",line 216,in _main
          status = self.run(options,args)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/cli/req_command.py",line 182,in wrapper
          return func(self,options,args)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/commands/install.py",line 325,in run
          reqs,check_supported_wheels=not options.target_dir
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py",line 183,in resolve
          discovered_reqs.extend(self._resolve_one(requirement_set,req))
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py",line 388,in _resolve_one
          abstract_dist = self._get_abstract_dist_for(req_to_install)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py",line 339,in _get_abstract_dist_for
          self._populate_link(req)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py",line 305,in _populate_link
          req.link = self._find_requirement_link(req)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py",line 270,in _find_requirement_link
          best_candidate = self.finder.find_requirement(req,upgrade)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/package_finder.py",line 899,in find_requirement
          req.name,specifier=req.specifier,hashes=hashes,File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/package_finder.py",line 881,in find_best_candidate
          candidates = self.find_all_candidates(project_name)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/package_finder.py",line 826,in find_all_candidates
          project_url,link_evaluator=link_evaluator,line 790,in process_project_url
          html_page = self._link_collector.fetch_page(project_url)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/collector.py",line 643,in fetch_page
          return _get_html_page(location,session=self.session)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/collector.py",line 455,in _get_html_page
          resp = _get_html_response(url,session=session)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/collector.py",line 169,in _get_html_response
          "Cache-Control": "max-age=0",File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py",line 543,in get
          return self.request('GET',url,**kwargs)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/network/session.py",line 421,in request
          return super(PipSession,self).request(method,*args,**kwargs)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py",line 530,in request
          resp = self.send(prep,**send_kwargs)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py",line 650,in send
          r = dispatch_hook('response',hooks,r,**kwargs)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_vendor/requests/hooks.py",line 31,in dispatch_hook
          _hook_data = hook(hook_data,**kwargs)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/network/auth.py",line 256,in handle_401
          username,password,save = self._prompt_for_password(parsed.netloc)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/network/auth.py",line 226,in _prompt_for_password
          username = ask_input("User for {}: ".format(netloc))
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/utils/misc.py",line 259,in ask_input
          return input(message)
      EOFError: EOF when reading a line
      User for pkgs.dev.azure.com:
      ----------------------------------------
    ERROR: Command errored out with exit status 2: /home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/bin/python /home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-che1xbcz/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/ -- 'setuptools>=41.0' setuptools-scm wheel Check the logs for full command output.

Check the log at /home/thomas/.cache/pre-commit/pre-commit.log

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...