When trying to install the Python dependencies with Poetry, I've the following error:
$ poetry install
The currently activated Python version 2.7.15 is not supported by the project (>=3.6).
Trying to find and use a compatible version.
Using python3 (3.7.4)
Skipping virtualenv creation, as specified in config file.
Updating dependencies
Resolving dependencies... (1.7s)
[SolverProblemError]
The current project's Python requirement (>=3.6) is not compatible with some of the required packages Python requirement:
- pre-commit requires Python >=3.6.1
Because no versions of pre-commit match >2.2.0,<3.0.0
and pre-commit (2.2.0) requires Python >=3.6.1, pre-commit is forbidden.
So, because my-proj depends on pre-commit (^2.2.0), version solving failed.
Here is my environment:
$ python3 --version
Python 3.7.4
$ poetry --version
Poetry version 1.0.5
$ pre-commit --version
pre-commit 2.2.0
And a sample of my pyproject.toml:
...
[tool.poetry.dependencies]
python = ">=3.6"
...
[tool.poetry.dev-dependencies]
pre-commit = "^2.2.0"
...
I've tried changing the python version in pyproject to 3.7, but didn't change the result. And if I remove the pre-commit dependency, I've got the same error on another dependency.
I don't know what should I look for: upgrading/downgrading the versions, incompatible versions
">=3.6.1"
inpyproject.toml
? – Mentalist>=3.6.1
it seems that it's now comparing with python 2.7:The current project's Python requirement (2.7.15) is not compatible with some of the required packages Python requirement: - pre-commit requires Python >=3.6.1
– Maccabeanpoetry.tool
section you need to reinstall the application so that poetry can rebuild the virtualenv with the new specification. Also, from your error messages it seems that you have some kind of python env activated throughvirtualenv
, maybe rundeactivate
before runningpoetry install
. – Mentalistpoetry config virtualenvs.create false
some time ago and the virtualenv wasn't created correctly for the project. After runningpoetry config virtualenvs.create true
everything works fine. – Maccabean