I've specified the dependencies of a library using Poetry and ^
version constraints. The dependencies conflict if you just install the latest version of the dependencies, but they are resolvable and poetry install
correctly resolves them. However, pip install
from pyproject.toml
does not correctly resolve them and creates a conflict.
Minimal example
directory structure:
poetry_poc/
poetry_poc/__init__.py
pyproject.toml
The __init__.py
file is empty and the contents of pyproject.toml
are:
[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"
The constraint snowflake-connector-python = "^2.2.9"
is only resolvable with version 2.2.9, so that gets installed. That library then requires requests<2.24.0
, and my project specifies requests^2.18.4
, so any version between 2.18.4 and 2.23.x would work just fine, but instead pip installs requests 2.24.0 and reports:
ERROR: snowflake-connector-python 2.2.9 has requirement requests<2.24.0, but you'll have requests 2.24.0 which is incompatible.
I've tried this on a brand new virtual environment with nothing but pip 20.1.1 and setuptools 39.0.1 installed, and I run pip install . --no-cache-dir
so every dependency will be downloaded anew. My poetry version is 1.0.10.
Is this the expected behavior—that pip won't resolve these types of conflicts—or am I doing something wrong, or is this a bug?