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
If you want to exclude one or more dependency groups for the installation, you can use the --without option. The --no-dev option is now deprecated. You should use the --without dev notation instead. You can also select optional dependency groups with the --with option.
By default, Poetry is installed into a platform and user-specific directory: ~/Library/Application Support/pypoetry on MacOS. ~/.local/share/pypoetry on Linux/Unix. %APPDATA%\pypoetry on Windows.
To run your script simply use poetry run python your_script.py . Likewise if you have command line tools such as pytest or black you can run them using poetry run pytest .
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With