You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am on the latest stable Poetry version, installed using a recommended method.
I have searched the issues of this repo and believe that this is not a duplicate.
I have consulted the FAQ and blog for any relevant entries or release notes.
If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.
Issue
Somehow, running poetry install or poetry show, (like in issue #7854), poetry's utils/env.py resolves to python bin, which in the context of the execution seems to be python 2.7, which in turn has no option -I.
Complete execution of poetry install -vvv:
Loading configuration file /home/ubuntu/.config/pypoetry/config.toml
Stack trace:
1 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1530 in _run
1528│ try:
1529│ if input_:
→ 1530│ output = subprocess.run(
1531│ cmd,
1532│ stdout=subprocess.PIPE,
CalledProcessError
Command '['python', '-I', '-W', 'ignore', '-']' returned non-zero exit status 2.
at /usr/lib/python3.10/subprocess.py:526 in run
522│ # We don't call process.wait() as .__exit__ does that for us.
523│ raise
524│ retcode = process.poll()
525│ if check and retcode:
→ 526│ raise CalledProcessError(retcode, process.args,
527│ output=stdout, stderr=stderr)
528│ return CompletedProcess(process.args, retcode, stdout, stderr)
529│
530│
The following error occurred when trying to handle this error:
Stack trace:
14 ~/.local/share/pypoetry/venv/lib/python3.10/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 ~/.local/share/pypoetry/venv/lib/python3.10/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│
12 ~/.local/share/pypoetry/venv/lib/python3.10/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 ~/.local/share/pypoetry/venv/lib/python3.10/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 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:454 in _run_command
452│
453│ try:
→ 454│ self._event_dispatcher.dispatch(command_event, COMMAND)
455│
456│ if command_event.command_should_run():
9 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/events/event_dispatcher.py:26 in dispatch
24│
25│ if listeners:
→ 26│ self._do_dispatch(listeners, event_name, event)
27│
28│ return event
8 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/events/event_dispatcher.py:89 in _do_dispatch
87│ break
88│
→ 89│ listener(event, event_name, self)
90│
91│ def _sort_listeners(self, event_name: str) -> None:
7 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/console/application.py:299 in configure_env
297│
298│ env_manager = EnvManager(poetry, io=io)
→ 299│ env = env_manager.create_venv()
300│
301│ if env.is_venv() and io.is_verbose():
6 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:895 in create_venv
893│
894│ cwd = self._poetry.file.parent
→ 895│ env = self.get(reload=True)
896│
897│ if not env.is_sane():
5 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:745 in get
743│ return self.get_system_env()
744│
→ 745│ return VirtualEnv(venv)
746│
747│ if env_prefix is not None:
4 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1721 in __init__
1719│ # from inside the virtualenv.
1720│ if base is None:
→ 1721│ output = self.run_python_script(GET_BASE_PREFIX)
1722│ assert isinstance(output, str)
1723│ self._base = Path(output.strip())
3 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1508 in run_python_script
1506│
1507│ def run_python_script(self, content: str, **kwargs: Any) -> int | str:
→ 1508│ return self.run(
1509│ self._executable,
1510│ "-I",
2 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1500 in run
1498│ def run(self, bin: str, *args: str, **kwargs: Any) -> str | int:
1499│ cmd = self.get_command_from_bin(bin) + list(args)
→ 1500│ return self._run(cmd, **kwargs)
1501│
1502│ def run_pip(self, *args: str, **kwargs: Any) -> int | str:
1 ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1781 in _run
1779│ def _run(self, cmd: list[str], **kwargs: Any) -> int | str:
1780│ kwargs["env"] = self.get_temp_environ(environ=kwargs.get("env"))
→ 1781│ return super()._run(cmd, **kwargs)
1782│
1783│ def get_temp_environ(
EnvCommandError
Command ['python', '-I', '-W', 'ignore', '-'] errored with the following return code 2
Error output:
Unknown option: -I
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
Input:
import sys
if hasattr(sys, "real_prefix"):
print(sys.real_prefix)
elif hasattr(sys, "base_prefix"):
print(sys.base_prefix)
else:
print(sys.prefix)
at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1545 in _run
1541│ return subprocess.call(cmd, stderr=stderr, env=env, **kwargs)
1542│ else:
1543│ output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
1544│ except CalledProcessError as e:
→ 1545│ raise EnvCommandError(e, input=input_)
1546│
1547│ return decode(output)
1548│
1549│ def execute(self, bin: str, *args: str, **kwargs: Any) -> int:
to my expected python env interpreter (/home/ubuntu/.local/share/pypoetry/venv/bin/python) forces the python interpreter to be correctly derived and installations resumes.
Edit: even though installation continues, the environment is borked. It still defaults to system's python binaries, bypassing any lib installed by poetry.
The text was updated successfully, but these errors were encountered:
Seems to be duplicate #7854 - as you yourself point out. If you have insight as to what's going on please make updates there rather than splitting discussion into two.
@dimbleby since the OP from #7854 failed to update the issue with relevant debugging information for over three days, I figured I should create a separate issue, but I will move my information there
-vvv
option) and have included the output below.Issue
Somehow, running
poetry install
orpoetry show
, (like in issue #7854), poetry'sutils/env.py
resolves topython
bin, which in the context of the execution seems to bepython 2.7
, which in turn has no option-I
.Complete execution of
poetry install -vvv
:Changing
poetry/src/poetry/utils/env.py
Line 1225 in 3804a13
to my expected python env interpreter (
/home/ubuntu/.local/share/pypoetry/venv/bin/python
) forces the python interpreter to be correctly derived and installations resumes.Edit: even though installation continues, the environment is borked. It still defaults to system's python binaries, bypassing any lib installed by poetry.
The text was updated successfully, but these errors were encountered: