python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.73k stars 2.27k forks source link

Command run `poetry env use` logs `Not enough arguments (missing: "python")` #8056

Closed brunolnetto closed 1 year ago

brunolnetto commented 1 year ago

Virtualenv Python: 3.8.10 Implementation: CPython Path: /home/brunolnetto/.cache/pypoetry/virtualenvs/appy--9Om1TDt-py3.8 Executable: /home/brunolnetto/.cache/pypoetry/virtualenvs/appy--9Om1TDt-py3.8/bin/python Valid: True

System Platform: linux OS: posix Python: 3.8.10 Path: /usr Executable: /usr/bin/python3.8

- **OS version and name**: Ubuntu 22.04
- **pyproject.toml**: https://raw.githubusercontent.com/trouchet/appy/main/pyproject.toml

- [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) stable Poetry version, installed using a recommended method.
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [x ] I have consulted the [FAQ](https://python-poetry.org/docs/faq/) and [blog](https://python-poetry.org/blog/) for any relevant entries or release notes.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option) and have included the output below.

## Issue

Run command `poetry env -vv use` does not activate or create a new virtualenv for the current project.  

Loading configuration file /home/brunolnetto/.config/pypoetry/config.toml Loading configuration file /home/brunolnetto/.config/pypoetry/auth.toml

Stack trace:

8 ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/cleo/application.py:327 in run 325│ 326│ try: → 327│ exit_code = self._run(io) 328│ except BrokenPipeError: 329│ # If we are piped to another process, it may close early and send a

7 ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/console/application.py:190 in _run 188│ self._load_plugins(io) 189│ → 190│ exit_code: int = super()._run(io) 191│ return exit_code 192│

6 ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/cleo/application.py:431 in _run 429│ io.input.interactive(interactive) 430│ → 431│ exit_code = self._run_command(command, io) 432│ self._running_command = None 433│

5 ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/cleo/application.py:473 in _run_command 471│ 472│ if error is not None: → 473│ raise error 474│ 475│ return terminate_event.exit_code

4 ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/cleo/application.py:457 in _run_command 455│ 456│ if command_event.command_should_run(): → 457│ exit_code = command.run(io) 458│ else: 459│ exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

3 ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/cleo/commands/base_command.py:119 in run 117│ io.input.validate() 118│ → 119│ status_code = self.execute(io) 120│ 121│ if status_code is None:

2 ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/cleo/commands/command.py:62 in execute 60│ 61│ try: → 62│ return self.handle() 63│ except KeyboardInterrupt: 64│ return 1

1 ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/console/commands/env/use.py:24 in handle 22│ return 0 23│ → 24│ env = manager.activate(self.argument("python")) 25│ 26│ self.line(f"Using virtualenv: {env.path}")

PythonVersionNotFound

Could not find the python executable use

at ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/env.py:577 in activate 573│ pass 574│ 575│ python_path = self._full_python_path(python) 576│ if python_path is None: → 577│ raise PythonVersionNotFound(python) 578│ 579│ try: 580│ python_version_string = decode( 581│ subprocess.check_output(

Secrus commented 1 year ago

You need to pass the Python you want to use. The error says it all.

brunolnetto commented 1 year ago

Do you mind, please, providing the solution in terms of command to run? I run poetry env use 3.8, which outputs the log Using virtualenv: {environment_path}, but it does not show the flag on the terminal. This makes me somewhat suspicious.

github-actions[bot] commented 8 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.