gpt4 book ai didi

python - 我如何才能准确找出是哪个包导致了 pip 回溯问题?

转载 作者:行者123 更新时间:2023-12-05 08:10:32 28 4
gpt4 key购买 nike

我有一个存储库,其中包含一组不同的 requirements.txt,用于一些不同的云功能。我在 bitbucket-pipelines.yml 中用一个循环将每个安装/测试分开:

for d in `find . -type d -maxdepth 1 -mindepth 1`; do
if [ -f "$d/requirements.txt" ]; then
echo "====="$d"====="
python3 -m pip install -r $d/requirements.txt
python3 -m coverage run -a --omit="*test*" -m unittest discover -v $d
fi
done

它工作得很好,除了我的一个功能,其中 pip 旋转它的轮子(双关语意)。这个函数恰好依赖于 Tensorflow,它具有各种更深层次的 Google 依赖项,而且这些似乎与其他函数依赖项不相容。但是你可能从 pip 中不知道这一 pip ,因为它只是产生一系列消息,比如

Collecting pandas
Downloading pandas-1.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.2/12.2 MB 46.0 MB/s eta 0:00:00
Downloading pandas-1.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.2/12.2 MB 41.6 MB/s eta 0:00:00
Downloading pandas-1.4.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.7/11.7 MB 62.0 MB/s eta 0:00:00
Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/lib/python3.9/site-packages (from requests->-r ./sleep/requirements.txt (line 5)) (2.1.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/site-packages (from requests->-r ./sleep/requirements.txt (line 5)) (2022.9.24)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/site-packages (from requests->-r ./sleep/requirements.txt (line 5)) (1.26.13)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.9/site-packages (from requests->-r ./sleep/requirements.txt (line 5)) (3.4)
Requirement already satisfied: setuptools in /usr/local/lib/python3.9/site-packages (from grpcio-tools>=1.44.0->-r ./sleep/requirements.txt (line 7)) (58.1.0)
Collecting data-consumption-interface>=1.11
Downloading https://pypi.biointellisense.com/packages/data-consumption-interface/1.11.0/data_consumption_interface-1.11.0-py3-none-any.whl (53 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.6/53.6 kB 65.1 MB/s eta 0:00:00
INFO: pip is looking at multiple versions of grpcio-tools to determine which version is compatible with other requirements. This could take a while.
Collecting grpcio-tools>=1.44.0
Downloading grpcio_tools-1.50.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 68.6 MB/s eta 0:00:00
INFO: pip is looking at multiple versions of requests to determine which version is compatible with other requirements. This could take a while.
Collecting requests
Downloading https://pypi.biointellisense.com/packages/requests/2.28.1/requests-2.28.1-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 70.2 MB/s eta 0:00:00
INFO: pip is looking at multiple versions of pandas to determine which version is compatible with other requirements. This could take a while.
Collecting pandas
Downloading pandas-1.4.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.7/11.7 MB 100.7 MB/s eta 0:00:00
Downloading pandas-1.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.7/11.7 MB 94.2 MB/s eta 0:00:00
Downloading pandas-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.7/11.7 MB 90.2 MB/s eta 0:00:00
Downloading pandas-1.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.7/11.7 MB 92.5 MB/s eta 0:00:00
Downloading pandas-1.3.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.5/11.5 MB 106.1 MB/s eta 0:00:00
Downloading pandas-1.3.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.5/11.5 MB 118.8 MB/s eta 0:00:00
Downloading pandas-1.3.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.5/11.5 MB 102.0 MB/s eta 0:00:00
INFO: pip is looking at multiple versions of pandas to determine which version is compatible with other requirements. This could take a while.
Downloading pandas-1.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.5/11.5 MB 83.4 MB/s eta 0:00:00
Downloading pandas-1.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.7/11.7 MB 107.7 MB/s eta 0:00:00
Downloading pandas-1.3.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (10.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.6/10.6 MB 122.8 MB/s eta 0:00:00
Downloading pandas-1.2.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (9.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.7/9.7 MB 111.9 MB/s eta 0:00:00
Downloading pandas-1.2.4-cp39-cp39-manylinux1_x86_64.whl (9.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.7/9.7 MB 100.2 MB/s eta 0:00:00
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
Downloading pandas-1.2.3-cp39-cp39-manylinux1_x86_64.whl (9.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.7/9.7 MB 116.0 MB/s eta 0:00:00
Downloading pandas-1.2.2-cp39-cp39-manylinux1_x86_64.whl (9.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.7/9.7 MB 113.7 MB/s eta 0:00:00
Downloading pandas-1.2.1-cp39-cp39-manylinux1_x86_64.whl (9.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.7/9.7 MB 106.8 MB/s eta 0:00:00
Downloading pandas-1.2.0-cp39-cp39-manylinux1_x86_64.whl (9.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.7/9.7 MB 110.1 MB/s eta 0:00:00
Downloading pandas-1.1.5-cp39-cp39-manylinux1_x86_64.whl (9.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.3/9.3 MB 84.5 MB/s eta 0:00:00
Downloading pandas-1.1.4-cp39-cp39-manylinux1_x86_64.whl (9.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.3/9.3 MB 110.9 MB/s eta 0:00:00
Downloading pandas-1.1.3-cp39-cp39-manylinux1_x86_64.whl (9.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.3/9.3 MB 120.0 MB/s eta 0:00:00
Downloading pandas-1.1.2.tar.gz (5.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.2/5.2 MB 94.3 MB/s eta 0:00:00
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: still running...
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Downloading pandas-1.1.1.tar.gz (5.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.2/5.2 MB 71.5 MB/s eta 0:00:00
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started

...不断。

我可以尝试在该函数的 requirements.txt 中设置某些库的特定版本,但是对于其他库,比如 tensorflow,我会得到这种无限倒退, urllib,或cffi

pip 在确定版本不兼容之前必须下载并尝试安装整个软件包,这确实有意义。这些都应该在元数据中可用。为什么python会这样工作? https://pip.pypa.io/en/stable/topics/dependency-resolution/

我无法确定具体是什么导致了这个问题。如何从日志中确定我需要 == version 的包? Pip 从来没有给我一条错误消息,说明是什么干扰导致它尝试回滚版本!社区需要解决这个问题。

这是脆弱的。我已经能够通过使用它足够长的时间来调和依赖关系几次,但这种方法无法扩展。然后,当某些深度依赖的新版本发布时,pip 会失去所有踪迹,不得不重新进行复杂的解析。

最佳答案

您的问题似乎已在另一个 Question 中得到解答

一 pip 解释:

首先我们假设我们使用python-version-2.5(因为我选择了这样 - 你必须用你的替换2.5>python版本)

  • 首先是避免多次请求的命令:例如$ python-2.5 -m pip install myfoopackage#you 通过指定你的 python 版本来避免它们(*因为它在你的如果我假设你输入了错误的 python 版本,你可以通过 $ python -V 找到它)
  • 从 0.8 版本开始,Pip 支持 pip-{python-version}例如pip-2.5 install myfoopackage #如你所见python-<VERSION> -m没有需要更长的时间
  • 从 1.5 版开始,他们将架构更改为 pip<VERSION>例如pip2.5 安装我的包

长话短说

尝试:

$ python -V
$ for f in find . -type f -iname "requirements*.txt"; do
pip<python_versoin> install -r $f
done

关于python - 我如何才能准确找出是哪个包导致了 pip 回溯问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74620601/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com