You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

pip安装依赖时遍历版本耗时久,为何未直接安装最新版?

问题:pip安装时遍历所有满足要求的依赖版本导致耗时过长

pip默认会安装满足所有要求的最新子依赖版本,但在全新conda环境中执行pip install -e .安装项目时,出现异常:pip会遍历从最低满足要求版本到最新版本的所有依赖包(如contourpy、transformers),尽管最终会安装最新版本,但该过程耗时极久。即使使用pip -vvv也无法找到遍历低版本的原因。

requirements.txt内容

datasets>=2.14.2
rouge-score>=0.0.4
nlpaug>=1.1.10
scikit-learn>=1.5.1
tqdm>=4.64.1
matplotlib>=3.6
pandas>=1.3.5
torch>=1.13.0
bs4
transformers>=4.40
nltk>=3.6.5
sacrebleu>=1.5.0
sentencepiece>=0.1.97
hf-lfs>=0.0.3
pytest>=4.4.1
pytreebank>=0.2.7
setuptools>=60.2.0
numpy>=1.23.5
dill>=0.3.5.1
scipy>=1.9.3
flask>=2.3.2
protobuf>=4.23
fschat>=0.2.3
hydra-core>=1.3.2
einops
accelerate>=0.32.1
bitsandbytes
openai>=1.52.0
wget
sentence-transformers
bert-score>=0.3.13
unbabel-comet==2.2.1
nltk>=3.7,<4
evaluate>=0.4.2
spacy>=3.4.0,<4
fastchat
diskcache>=5.6.3

安装时的部分日志示例

Collecting contourpy>=1.0.1 (from matplotlib>=3.6->lm_polygraph==0.0.0)
  Using cached contourpy-1.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.8 kB)
  Using cached contourpy-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.8 kB)
  Using cached contourpy-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.9 kB)
  Using cached contourpy-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.7 kB)
  Using cached contourpy-1.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.8 kB)
  Using cached contourpy-1.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.5 kB)
  Using cached contourpy-1.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.3 kB)
  Using cached contourpy-1.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
  Using cached contourpy-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.0 kB)
  Using cached contourpy-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.2 kB)
  Using cached contourpy-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.2 kB)

环境信息

python --version
Python 3.10.0
pip --version
pip 24.2 from /apps/local/anaconda3/envs/polygraph_test/lib/python3.10/site-packages/pip (python 3.10)

补充说明:最终确实安装了最新版本(如contourpy 1.3.0),但遍历过程耗时过长。

内容的提问来源于stack exchange,提问作者Roman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 22:14:52