`poetry env` doesn't work on Windows after install-poetry.py
See original GitHub issue-
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 (
-vvv
option). -
OS version and name: Windows 10
-
Poetry version: 1.1.11
-
Link of a Gist with the contents of your pyproject.toml file: N/A
Issue
After installing poetry, creating a fresh project and running poetry env list
the following error occurs:
EnvCommandError
Command python -W ignore - errored with the following return code 1, and output:
'python' is not recognized as an internal or external command,
operable program or batch file.
input was : 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 c:\...\poetry\venv\lib\site-packages\poetry\utils\env.py:1183 in _run
1179│ output = subprocess.check_output(
1180│ cmd, stderr=subprocess.STDOUT, **kwargs
1181│ )
1182│ except CalledProcessError as e:
→ 1183│ raise EnvCommandError(e, input=input_)
1184│
1185│ return decode(output)
1186│
1187│ def execute(self, bin, *args, **kwargs):
This appears to be due to the following at lines 1233-1236 in https://github.com/python-poetry/poetry/blob/1.1/poetry/utils/env.py:
if not bin.endswith(".exe"):
bin_path = self._bin_dir / (bin + ".exe")
else:
bin_path = self._path / bin
I believe in the first case self._path should be used instead of self._bin_dir.
This problem doesn’t appear to happen (the function is never called) when poetry is installed with get-poetry.py
instead of install-poetry.py
. I don’t know why that is, but it’s a good workaround. I think the above code is wrong nonetheless.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
With apologies, I’m pinging the 4 members of the python-poetry project since the “@python-poetry/triage” as mentioned in the docs doesn’t work: @sdispater @abn @finswimmer @stephsamson
This issue has been present since 1.1.9 and renders poetry unusable on Windows. It’s a simple typo with a one-line fix.
Any timeline on when this will be resolved?