commit with docker失败原因排查

设备

  • 操作系统:Win10
  • 编辑器:VSCode
  • 环境管理工具:Conda 24.7.1
  • Python版本:3.9

问题描述

在Conda环境下安装依赖包时,项目使用了pre-commit工具,但在执行commit操作时出现以下报错:

[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: ('C:\\Users\\...\\.cache\\pre-commit\\repo1iqbheha\\py_env-default\\Scripts\\python.EXE', '-mpip', 'install', '.') 
return code: 1
stdout: 
    Processing c:\users\...\...\.cache\pre-commit\repo1iqbheha 
      Installing build dependencies: started 
      Installing build dependencies: finished with status 'error'
stderr: 
    WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

推测

根据可能造成问题的原因依次检查:

1.conda版本过旧
(conda版本一开始是23年的,commit不了后更新到最新版本24.7.1,依旧不行)

2.使用pre-commit没有初始化

pre-commit install

(仍然失败)

3.缺少ssl配置或网络连接问题
(用脚本检查,若打印出 “SSL connection successful!" 以及状态码200,说明python环境支持SSL,并且能够通过https连接到网站。这里开了代理成功连接到了。)
jianchadaima
jieguo

4.使用的pip不正确

get-command pip

(使用的pip就是conda的pip,没有问题)

5.代理影响了commit
(不管开不开代理,或者切换节点,都报一样的错)

6.pre-commit版本太高
(下载依赖没有指定pre-commit的版本,下载的是3.8的版本,咨询师兄建议版本降到3.3.1。 重新下载并初始化后,仍然不行)

7.interpreter选择错误
使用的就是conda\envs\虚拟环境下的python(3.9.19),没有问题。

总结

所有可能性排查完都没有解决,推测是我的电脑配置问题。目前的解决方案是用docker重新测试一下。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值