解决pip install “git+url”时GnuTLs recv error (-110): The TLS connection was non-properly terminated报错

本文讲述了在安装pypcocotools库时遇到的TLS连接错误,提出通过克隆库到本地再安装的方法。给出了详细的步骤,包括编辑.bashrc文件以解决gitclone失败的问题。


1 问题描述

安装pycocotools库时出现如下报错:

在这里插入图片描述

其中GnuTLs recv error (-110)意味着TLS连接没有被正确地终止,这可能是存在网络连接问题或者Git存储库存在配置问题导致的,并不是pip的问题。但是,可以看到克隆是成功了的。




2 解决方案

这种情况下,我们可以尝试先将库克隆到本地,然后再从本地安装库,从而绕过直接从Git存储库下载文件时的网络连接问题。

2.1 克隆库

克隆库到本地的指令为:git clone [url]

示例(pycocotools):

在这里插入图片描述

2.2 安装库

安装库的指令为:pip install [package_name]

示例(pycocotools):

在这里插入图片描述pycocotools安装成功。


2.3 git clone失败的解决办法

1.输入命令:vim ~/.bashrc 进入.bashrc文件

2.按 a 进入编辑模式

3.在文件最后添加下面三行内容:
$ export GIT_TRACE_PACKET=1
$ export GIT_TRACE=1
$ export GIT_CURL_VERBOSE=1

4.按Esc退出编辑模式

5.输入:wq保存并退出

6.输入指令:source ~/.bashrc 加载更新后的配置

尝试再次克隆。


jzuser@vpc87-3:~/Work_dir/Gn/pystudy/NnuNet$ # 删除旧目录 rm -rf nnUNet # 克隆仓库 git clone https://github.com/MIC-DKFZ/nnUNet.git # 切换到 dev 分支 cd nnUNet git fetch origin git checkout dev # 安装为开发包 pip install -e . # 验证 python -c "from nnUNet.experiment_planning.planners import nnUNetPlanner2D; print('导入成功')" Cloning into 'nnUNet'... remote: Enumerating objects: 14005, done. remote: Counting objects: 100% (139/139), done. remote: Compressing objects: 100% (69/69), done. remote: Total 14005 (delta 104), reused 70 (delta 70), pack-reused 13866 (from 3) Receiving objects: 100% (14005/14005), 8.63 MiB | 32.00 KiB/s, done. Resolving deltas: 100% (10664/10664), done. fatal: unable to access 'https://github.com/MIC-DKFZ/nnUNet.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated. error: pathspec 'dev' did not match any file(s) known to git Defaulting to user installation because normal site-packages is not writeable Obtaining file:///home/jzuser/Work_dir/Gn/pystudy/NnuNet/nnUNet Installing build dependencies ... done Checking if build backend supports build_editable ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Installing collected packages: UNKNOWN Running setup.py develop for UNKNOWN error: subprocess-exited-with-error × python setup.py develop did not run successfully. │ exit code: 1 ╰─> [32 lines of output] running develop /usr/lib/python3/dist-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( WARNING: The user site-packages directory is disabled. /usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '/usr/local/lib/python3.10/dist-packages/test-easy-install-10060.write-test' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /usr/local/lib/python3.10/dist-packages/ Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://setuptools.pypa.io/en/latest/deprecated/easy_install.html Please make the appropriate changes for your system and try again. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × python setup.py develop did not run successfully. │ exit code: 1 ╰─> [32 lines of output] running develop /usr/lib/python3/dist-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( WARNING: The user site-packages directory is disabled. /usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '/usr/local/lib/python3.10/dist-packages/test-easy-install-10060.write-test' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /usr/local/lib/python3.10/dist-packages/ Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://setuptools.pypa.io/en/latest/deprecated/easy_install.html Please make the appropriate changes for your system and try again. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. Command 'python' not found, did you mean: command 'python3' from deb python3 command 'python' from deb python-is-python3
08-22
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值