-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
area/cliRelated to the command lineRelated to the command linekind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/confirmedIssue is reproduced and confirmedIssue is reproduced and confirmedstatus/triageThis issue needs to be triagedThis issue needs to be triaged
Description
Description
When running "poetry self update" in a directory not containing a pyproject.toml file (such as the home directory), poetry quits with "Poetry could not find a pyproject.toml file in /home/srittau or its parents". It seems unnecessary to run self commands from a "real" project directory.
Workarounds
Running the self commands in any existing project directory. This is more difficult on a new system or installing poetry automatically (for example, using Ansible).
Poetry Installation Method
install.python-poetry.org
Operating System
Ubuntu 24.04.1
Poetry Version
Poetry (version 2.0.0)
Poetry Configuration
cache-dir = "/home/srittau/.cache/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /home/srittau/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = falsePython Sysconfig
Platform: "linux-x86_64"
Python version: "3.12"
Current installation scheme: "venv"
Paths:
data = "/opt/ansible/ansible"
include = "/usr/include/python3.12"
platinclude = "/usr/include/python3.12"
platlib = "/opt/ansible/ansible/lib/python3.12/site-packages"
platstdlib = "/opt/ansible/ansible/lib/python3.12"
purelib = "/opt/ansible/ansible/lib/python3.12/site-packages"
scripts = "/opt/ansible/ansible/bin"
stdlib = "/usr/lib/python3.12"
Variables:
[... please let me know if you require specific output]Example pyproject.toml
No response
Poetry Runtime Logs
$ poetry -vvv self update
Loading configuration file /home/srittau/.config/pypoetry/config.toml
Updating Poetry version ...
Stack trace:
14 /opt/ansible/poetry/venv/lib/python3.12/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
13 /opt/ansible/poetry/venv/lib/python3.12/site-packages/poetry/console/application.py:236 in _run
234│
235│ with directory(self._working_directory):
→ 236│ exit_code: int = super()._run(io)
237│
238│ return exit_code
12 /opt/ansible/poetry/venv/lib/python3.12/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│
11 /opt/ansible/poetry/venv/lib/python3.12/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
10 /opt/ansible/poetry/venv/lib/python3.12/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
9 /opt/ansible/poetry/venv/lib/python3.12/site-packages/cleo/commands/base_command.py:117 in run
115│ io.input.validate()
116│
→ 117│ return self.execute(io) or 0
118│
119│ def merge_application_definition(self, merge_args: bool = True) -> None:
8 /opt/ansible/poetry/venv/lib/python3.12/site-packages/cleo/commands/command.py:61 in execute
59│
60│ try:
→ 61│ return self.handle()
62│ except KeyboardInterrupt:
63│ return 1
7 /opt/ansible/poetry/venv/lib/python3.12/site-packages/poetry/console/commands/self/self_command.py:132 in handle
130│
131│ with directory(self.system_pyproject.parent):
→ 132│ return self._system_project_handle()
133│
6 /opt/ansible/poetry/venv/lib/python3.12/site-packages/poetry/console/commands/self/update.py:49 in _system_project_handle
47│ assert isinstance(add_command, AddCommand)
48│ add_command.set_env(self.env)
→ 49│ application.configure_installer_for_command(add_command, self.io)
50│
51│ argv = ["add", f"poetry@{self.argument('version')}"]
5 /opt/ansible/poetry/venv/lib/python3.12/site-packages/poetry/console/application.py:375 in configure_installer_for_command
373│ from poetry.installation.installer import Installer
374│
→ 375│ poetry = command.poetry
376│ installer = Installer(
377│ io,
4 /opt/ansible/poetry/venv/lib/python3.12/site-packages/poetry/console/commands/command.py:24 in poetry
22│ def poetry(self) -> Poetry:
23│ if self._poetry is None:
→ 24│ return self.get_application().poetry
25│
26│ return self._poetry
3 /opt/ansible/poetry/venv/lib/python3.12/site-packages/poetry/console/application.py:181 in poetry
179│ return self._poetry
180│
→ 181│ self._poetry = Factory().create_poetry(
182│ cwd=self._project_directory,
183│ io=self._io,
2 /opt/ansible/poetry/venv/lib/python3.12/site-packages/poetry/factory.py:60 in create_poetry
58│ io = NullIO()
59│
→ 60│ base_poetry = super().create_poetry(cwd=cwd, with_groups=with_groups)
61│
62│ if version_str := base_poetry.local_config.get("requires-poetry"):
1 /opt/ansible/poetry/venv/lib/python3.12/site-packages/poetry/core/factory.py:48 in create_poetry
46│ from poetry.core.pyproject.toml import PyProjectTOML
47│
→ 48│ poetry_file = self.locate(cwd)
49│ pyproject = PyProjectTOML(path=poetry_file)
50│
RuntimeError
Poetry could not find a pyproject.toml file in /home/srittau or its parents
at /opt/ansible/poetry/venv/lib/python3.12/site-packages/poetry/core/factory.py:802 in locate
798│ if poetry_file.exists():
799│ return poetry_file
800│
801│ else:
→ 802│ raise RuntimeError(
803│ f"Poetry could not find a pyproject.toml file in {cwd} or its parents"
804│ )
805│Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/cliRelated to the command lineRelated to the command linekind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/confirmedIssue is reproduced and confirmedIssue is reproduced and confirmedstatus/triageThis issue needs to be triagedThis issue needs to be triaged