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
As mentionned by @Arne in the comments, it seemed to be a virtualenv problem.
I've run poetry config virtualenvs.create false
previously for another project and the configuration was set at a global level. Running the reverse command poetry config virtualenvs.create true
solved the problem (maybe add --local
to set it to individual projects).