-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
- 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 (
-vvvoption).
- OS version and name: Linux Mint 20.1
- Poetry version: 1.1.6
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/joooeey/78317c68c58d8aaa2d452c02212031f3
Issue
We're developing a project on a few machines with several different Python versions installed. We're using Poetry to make sure we have the same development environment. But unfortunately Poetry doesn't check if the right Python version is installed. I expect to get an error or a warning if Poetry isn't running on the Python version specified in the pyproject.toml file (Python 3.9). But Poetry lets this slip, so when working on my laptop the other day I only got a failure at runtime when suddenly tons of errors with type annotation popped up. It took me a while to figure out this was because I was using an old Python version (3.8).
To reproduce, copy the pyproject.toml linked above and run the following commands:
(base) lukas@ThinkPad-T560:~/Desktop/poetry_test$ poetry install
Updating dependencies
Resolving dependencies... (0.1s)
Writing lock file
(base) lukas@ThinkPad-T560:~/Desktop/poetry_test$ poetry run python
Python 3.8.5 (default, Sep 4 2020, 07:30:14)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
(base) lukas@ThinkPad-T560:~/Desktop/poetry_test$ poetry env info
Virtualenv
Python: 3.8.5
Implementation: CPython
Path: /home/lukas/.cache/pypoetry/virtualenvs/edeo-sensing-iAOxxtc0-py3.8
Valid: True
System
Platform: linux
OS: posix
Python: /home/lukas/anaconda3
(base) lukas@ThinkPad-T560:~/Desktop/poetry_test$ poetry --version
4Poetry version 1.1.6
(base) lukas@ThinkPad-T560:~/Desktop/poetry_test$ 4I would have expected Python to run on 3.9 or if it can't find that version I would expect it to display an error or warning during poetry install.
See also:
- Closed, similar issue: No method to control the python version used #522
- An older attempt to fix this, but not applicable if you want to develop on multiple machines: New env command and sub commands #731
- Another merged PR that was supposed to fix this if I understand it correctly: Improve environment management #1477