pip - Pip 为使用 Poetry 构建的库安装了不必要的冲突依赖项
问题描述
^
我已经使用 Poetry 和版本约束指定了库的依赖关系。如果您只是安装最新版本的依赖项,则依赖项会发生冲突,但它们是可解析的并poetry install
正确解析它们。但是,pip install
frompyproject.toml
不能正确解决它们并产生冲突。
最小的例子
目录结构:
poetry_poc/
poetry_poc/__init__.py
pyproject.toml
该__init__.py
文件为空,内容为pyproject.toml
:
[tool.poetry]
name = "poetry_poc"
version = "0.1.0"
description = "minimal example of issue"
authors = ["Your Name <you@example.com>"]
[tool.poetry.dependencies]
python = "^3.6"
requests = "^2.18.4"
snowflake-connector-python = "^2.2.9"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
该约束snowflake-connector-python = "^2.2.9"
只能在 2.2.9 版本中解决,因此可以安装。然后该库需要 requests<2.24.0
,并且我的项目指定requests^2.18.4
,因此 2.18.4 和 2.23.x 之间的任何版本都可以正常工作,但 pip 安装请求 2.24.0 并报告:
ERROR: snowflake-connector-python 2.2.9 has requirement requests<2.24.0, but you'll have requests 2.24.0 which is incompatible.
我已经在一个全新的虚拟环境中尝试过这个,只安装了 pip 20.1.1 和 setuptools 39.0.1,然后我运行pip install . --no-cache-dir
,所以每个依赖项都将重新下载。我的诗歌版本是1.0.10。
这是预期的行为 - pip 不会解决这些类型的冲突 - 还是我做错了什么,或者这是一个错误?
解决方案
推荐阅读
- python - 仅在数据框中提取最小值
- c# - 如何使用相同的过滤器同时过滤集合及其嵌套集合?
- c# - Application Insight 中的范围日志记录
- python - C++ DLL 中的 Python 对象
- google-api - Google 登录同意页面未针对我的应用程序请求的所有范围请求许可
- c++ - Windows 控制台调整大小被忽略 - 屏幕缓冲区搞砸了
- python - for循环中某些值的条件(Python pandas)
- java - 发布密钥无法与已部署的应用程序一起使用
- javascript - 访问 localstorage 中的 `access_token` 属性
- sql-server - 按日期查找 SQL Server 查询?