Skip to content

Failed to install packages that target a range of python versions if local python version is not fixed #1413

@MarcBoissonneault

Description

@MarcBoissonneault
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
▶ poetry debug:info

Poetry
======

 * Version: 0.12.17
 * Python:  3.7.0


Virtualenv
==========

 * Python:         3.7.0
 * Implementation: CPython
 * Path:           /Users/user/projectX/.venv
 * Valid:          True


System
======

 * Platform: darwin
 * OS:       posix
 * Python:   /Users/user/.pyenv/versions/3.7.0

pyproject.toml

[tool.poetry]
name = "projectX"
version = "0.1.0"
description = ""
authors = ["user <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.7"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

Issue

When I try to install a dependency that target a range of python versions, that seems to contains the python version I target in my pyproject.toml it fails with the following error.

▶ poetry add kedro -vvv
Using virtualenv: /Users/user/projectX/.venv
PyPI: 7 packages found for kedro *
Using version ^0.15.1 for kedro

Updating dependencies
Resolving dependencies...
   1: fact: projectX is 0.1.0
   1: derived: projectX
   1: fact: projectX depends on kedro (^0.15.1)
   1: selecting projectX (0.1.0)
   1: derived: kedro (^0.15.1)
PyPI: 1 packages found for kedro >=0.15.1,<0.16.0
   1: fact: kedro (0.15.1) requires Python >=3.5, <3.8
   1: derived: not kedro (0.15.1)
   1: fact: no versions of kedro match >0.15.1,<0.16.0
   1: conflict: no versions of kedro match >0.15.1,<0.16.0
   1: ! kedro (>0.15.1,<0.16.0) is partially satisfied by not kedro (0.15.1)
   1: ! which is caused by "kedro (0.15.1) requires Python >=3.5, <3.8"
   1: ! thus: kedro is forbidden
   1: ! kedro (>=0.15.1,<0.16.0) is satisfied by kedro (^0.15.1)
   1: ! which is caused by "projectX depends on kedro (^0.15.1)"
   1: ! thus: version solving failed
   1: Version solving took 0.037 seconds.
   1: Tried 1 solutions.

[SolverProblemError]
The current project must support the following Python versions: ^3.7
Because no versions of kedro match >0.15.1,<0.16.0
 and kedro (0.15.1) requires Python >=3.5, <3.8, kedro is forbidden.
So, because projectX depends on kedro (^0.15.1), version solving failed.

Exception trace:
 /Users/user/.poetry/lib/poetry/_vendor/py3.7/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /Users/user/.poetry/lib/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /Users/user/.poetry/lib/poetry/_vendor/py3.7/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /Users/user/.poetry/lib/poetry/console/commands/command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 /Users/user/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 /Users/user/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/command.py in execute() at line 107
   return self.handle()
 /Users/user/.poetry/lib/poetry/console/commands/add.py in handle() at line 139
   status = installer.run()
 /Users/user/.poetry/lib/poetry/installation/installer.py in run() at line 73
   self._do_install(local_repo)
 /Users/user/.poetry/lib/poetry/installation/installer.py in _do_install() at line 165
   ops = solver.solve(use_latest=self._whitelist)
 /Users/user/.poetry/lib/poetry/puzzle/solver.py in solve() at line 38
   packages, depths = self._solve(use_latest=use_latest)
 /Users/user/.poetry/lib/poetry/puzzle/solver.py in _solve() at line 180
   raise SolverProblemError(e)

add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...

As you can see from the error and from the kedro pypi release page, the target python version is Python >=3.5, <3.8.
I specify python ^3.7 in my pyprojet.toml and as you can see when I run poetry debug:info my python version is * Python: 3.7.0 .

Other info, if I change the pyproject.toml:

[tool.poetry.dependencies]
python = "^3.7"

To:

[tool.poetry.dependencies]
python = "3.7"

It's working

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/solverRelated to the dependency resolverkind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions