[x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
OS version and name: Ubuntu 18.04.3 LTS
Poetry version 1.0.0I wanted to start using python 3.8 in a project:
禄 poetry env use -vvv 3.8.0
[NoCompatiblePythonVersionFound]
The specified Python version (3.8) is not supported by the project (^3.7).
Please choose a compatible version or loosen the python constraint specified in the pyproject.toml file.
Traceback (most recent call last):
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/console_application.py", line 131, in run
status_code = command.handle(parsed_args, io)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 120, in handle
status_code = self._do_handle(args, io)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 171, in _do_handle
return getattr(handler, handler_method)(args, io, self)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/cleo/commands/command.py", line 92, in wrap_handle
return self.handle()
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/console/commands/env/use.py", line 23, in handle
env = manager.activate(self.argument('python'), self._io)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 259, in activate
self.create_venv(io, executable=python, force=create)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 520, in create_venv
self._poetry.package.python_versions, python_minor
You should use only the minor version with env use:
poetry env use 3.8
Basically, Poetry looks for a python3.8.0 executable which it does not find leading to this error.
Hello @jobevers ,
I guess the error message is misleading. poetry env use expect the path to an python executable and not a version number.
So specify the complete path to the python 3.8 interpreter or, if you use pyenv for handling multiple python versions, activate the correct version first.
fin swimmer
禄 poetry env use -vvv 3.8
[NoCompatiblePythonVersionFound]
The specified Python version (3.8) is not supported by the project (^3.7).
Please choose a compatible version or loosen the python constraint specified in the pyproject.toml file.
Traceback (most recent call last):
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/console_application.py", line 131, in run
status_code = command.handle(parsed_args, io)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 120, in handle
status_code = self._do_handle(args, io)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 171, in _do_handle
return getattr(handler, handler_method)(args, io, self)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/cleo/commands/command.py", line 92, in wrap_handle
return self.handle()
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/console/commands/env/use.py", line 23, in handle
env = manager.activate(self.argument('python'), self._io)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 259, in activate
self.create_venv(io, executable=python, force=create)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 520, in create_venv
self._poetry.package.python_versions, python_minor
@jobevers Do you actually have a python3.8 executable in your PATH?
poetry env use -vvv /home/jobevers/code/pyenv/versions/3.8.0/bin/python
[NoCompatiblePythonVersionFound]
The specified Python version (3.8) is not supported by the project (^3.7).
Please choose a compatible version or loosen the python constraint specified in the pyproject.toml file.
Traceback (most recent call last):
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/console_application.py", line 131, in run
status_code = command.handle(parsed_args, io)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 120, in handle
status_code = self._do_handle(args, io)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 171, in _do_handle
return getattr(handler, handler_method)(args, io, self)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/cleo/commands/command.py", line 92, in wrap_handle
return self.handle()
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/console/commands/env/use.py", line 23, in handle
env = manager.activate(self.argument('python'), self._io)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 259, in activate
self.create_venv(io, executable=python, force=create)
File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 520, in create_venv
self._poetry.package.python_versions, python_minor
禄 which python3.8
/home/jobevers/code/pyenv/shims/python3.8
Oh, I know what's going on, this is a bug in how Poetry gets the patch version of the executable. Basically, it uses the current Python for the patch version instead of the one of the passed executable.
This should be an easy fix.
@sdispater could you cut a patch release that includes this fix?
+1 having this issue at the moment with python 3.8.2.
Edit:
changing
[tool.poetry.dependencies]
python = "3.8"
to
[tool.poetry.dependencies]
python = "^3.8"
worked.
I guess initially set it too strictly without knowing
I guess initially set it too strictly without knowing
I'm getting mixed results - work for me but not the person next to me, not sure which is expected behaviour. When saying:
[tool.poetry.dependencies]
python = "3.8"
which patch versions does that support?
+1 having this issue at the moment with python 3.8.2.
Edit:
changing[tool.poetry.dependencies] python = "3.8"to
[tool.poetry.dependencies] python = "^3.8"worked.
I guess initially set it too strictly without knowing
Thank you kamyar
This solution worked for me also. Python 3.8.5
Most helpful comment
+1 having this issue at the moment with python 3.8.2.
Edit:
changing
to
worked.
I guess initially set it too strictly without knowing