Poetry: Cannot resolve Python version

Created on 15 Dec 2018  路  9Comments  路  Source: python-poetry/poetry

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

Config:

[tool.poetry]
name = "my-package"
version = "0.1.0"
authors = ["oooo"]

[tool.poetry.dependencies]
poetry = {git='https://github.com/sdispater/poetry.git', branch='master'}

Output of poetry lock:

Updating dependencies
Resolving dependencies... (4.1s)

[SolverProblemError]                                         
The current project must support the following Python versions: *         
Because no versions of poetry match !=0.12.10                             
 and poetry (0.12.10) requires Python ~2.7 || ^3.4, poetry is forbidden.  
So, because my-package depends on poetry (*), version solving failed.     

lock

Output of poetry debug:info:

======

 * Version: 0.12.10
 * Python:  3.5.2


Virtualenv
==========

 * Python:         3.5.2
 * Implementation: CPython
 * Path:           NA


System
======

 * Platform: linux
 * OS:       posix
 * Python:   /usr

Output of lock with -vvv:

Virtualenv my-package-py3.5 already exists.
Using virtualenv: /home/gram/.cache/pypoetry/virtualenvs/my-package-py3.5
Updating dependencies
Resolving dependencies...
   1: fact: my-package is 0.1.0
   1: derived: my-package
   1: fact: my-package depends on poetry (*)
   1: selecting my-package (0.1.0)
   1: derived: poetry (*)
   1: fact: poetry (0.12.10) requires Python ~2.7 || ^3.4
   1: derived: not poetry (0.12.10)
   1: fact: no versions of poetry match !=0.12.10
   1: conflict: no versions of poetry match !=0.12.10
   1: ! poetry (!=0.12.10) is partially satisfied by not poetry (0.12.10)
   1: ! which is caused by "poetry (0.12.10) requires Python ~2.7 || ^3.4"
   1: ! thus: poetry is forbidden
   1: ! poetry (*) is satisfied by poetry (*)
   1: ! which is caused by "my-package depends on poetry (*)"
   1: ! thus: version solving failed
   1: Version solving took 3.994 seconds.
   1: Tried 1 solutions.

[SolverProblemError]                                         
The current project must support the following Python versions: *         
Because no versions of poetry match !=0.12.10                             
 and poetry (0.12.10) requires Python ~2.7 || ^3.4, poetry is forbidden.  
So, because my-package depends on poetry (*), version solving failed.     

Exception trace:
 /home/gram/.local/lib/python3.5/site-packages/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /home/gram/.local/lib/python3.5/site-packages/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /home/gram/.local/lib/python3.5/site-packages/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /home/gram/.local/lib/python3.5/site-packages/poetry/console/commands/command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 /home/gram/.local/lib/python3.5/site-packages/cleo/commands/base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 /home/gram/.local/lib/python3.5/site-packages/cleo/commands/command.py in execute() at line 107
   return self.handle()
 /home/gram/.local/lib/python3.5/site-packages/poetry/console/commands/lock.py in handle() at line 33
   return installer.run()
 /home/gram/.local/lib/python3.5/site-packages/poetry/installation/installer.py in run() at line 76
   self._do_install(local_repo)
 /home/gram/.local/lib/python3.5/site-packages/poetry/installation/installer.py in _do_install() at line 158
   ops = solver.solve(use_latest=self._whitelist)
 /home/gram/.local/lib/python3.5/site-packages/poetry/puzzle/solver.py in solve() at line 38
   packages, depths = self._solve(use_latest=use_latest)
 /home/gram/.local/lib/python3.5/site-packages/poetry/puzzle/solver.py in _solve() at line 180
   raise SolverProblemError(e)

lock
stale

Most helpful comment

I just hit this problem with an app that defined python = "^3.6" and a dependency that required python = ">=3.6,<3.8". How is it possible this fails to install under python 3.6 or 3.7?

This is the expected behavior, and to fix it you need to declare your project as compatible with Python ~2.7 || ^3.4.

I honestly don't understand how is that the solution, what if your app depends on two libraries and one defines ~2.7 || ^3.4 and the other 3.4.*? Does that mean that's not supported? Shouldn't just be a matter of checking the current python version and making sure it's compatible with the application and the dependencies?

All 9 comments

Don't try to install poetry with poetry. Use get-poetry.py (https://github.com/sdispater/poetry#installation) which keeps poetry and its deps separate from all pythons.

It doesn't depend. Same issue with cleo from git:

[tool.poetry]
name = "my-package"
version = "0.1.0"
authors = ["oooo"]

[tool.poetry.dependencies]
cleo = { git = "https://github.com/sdispater/cleo.git", branch = "master" }

$ poetry lock
Updating dependencies
Resolving dependencies... (1.6s)

[SolverProblemError]
The current project must support the following Python versions: *
Because no versions of cleo match !=0.7.2
and cleo (0.7.2) requires Python ~2.7 || ^3.4, cleo is forbidden.
So, because my-package depends on cleo (*), version solving failed.

lock

@orsinium can you please verify that you installed poetry with get-poetry.py as @garyo said, and not via some other method such as pip install poetry?

cleo is also a dependency of poetry, and that is why you need to keep poetry isolated from your active python venv.

You can reproduce it in isolated environment:

docker run -it python:3.7.1-stretch bash
root@207fd2067cdb:/# curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

$HOME/.poetry/bin

This path will then be added to your `PATH` environment variable by
modifying the profile file located at:

$HOME/.profile

You can uninstall at any time with `poetry self:uninstall`,
or by executing this script with the --uninstall option,
and these changes will be reverted.

Installing version: 0.12.10
  - Downloading poetry-0.12.10-linux.tar.gz (8.35MB)

Poetry (0.12.10) is installed now. Great!

To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.

To configure your current shell run `source $HOME/.poetry/env`

root@207fd2067cdb:/# apt-get update
root@207fd2067cdb:/# apt-get install nano
root@207fd2067cdb:/# nano pyproject.toml
root@207fd2067cdb:/# ~/.poetry/bin/poetry lock
Creating virtualenv my-package-py3.7 in /root/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies... (2.6s)

[SolverProblemError]                                    
The current project must support the following Python versions: *    
Because no versions of cleo match !=0.7.2                            
 and cleo (0.7.2) requires Python ~2.7 || ^3.4, cleo is forbidden.   
So, because my-package depends on cleo (*), version solving failed.  

lock

root@207fd2067cdb:/# 

Config:

[tool.poetry]
name = "my-package"
version = "0.1.0"
authors = ["oooo"]

[tool.poetry.dependencies]
cleo = { git = "https://github.com/sdispater/cleo.git", branch = "master" }

@orsinium The message says it all but I will try to explain it more clearly. The current project says it's compatible with any Python version (*), which means, for instance, Python 2.6 or Python 3.2. However, cleo is only compatible officially with Python ~2.7 || ^3.4 which which does not include Python 2.6 or 3.2, hence the error you get.

This is the expected behavior, and to fix it you need to declare your project as compatible with Python ~2.7 || ^3.4.

This failure is a very common on poetry with people using * as version.
Maybe a custom message would be more explicit for this case :

... previous message.. + tip : your python version/package version is set to "*", maybe you can solve this error being more precise. ex : ^3.4

I just hit this problem with an app that defined python = "^3.6" and a dependency that required python = ">=3.6,<3.8". How is it possible this fails to install under python 3.6 or 3.7?

This is the expected behavior, and to fix it you need to declare your project as compatible with Python ~2.7 || ^3.4.

I honestly don't understand how is that the solution, what if your app depends on two libraries and one defines ~2.7 || ^3.4 and the other 3.4.*? Does that mean that's not supported? Shouldn't just be a matter of checking the current python version and making sure it's compatible with the application and the dependencies?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Closing this issue automatically because it has not had any activity since it has been marked as stale. If you think it is still relevant and should be addressed, feel free to open a new one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jbarlow83 picture jbarlow83  路  3Comments

thmo picture thmo  路  3Comments

ulope picture ulope  路  3Comments

thejohnfreeman picture thejohnfreeman  路  3Comments

mozartilize picture mozartilize  路  3Comments