python-poetry / python-poetry/poetry
Poetry 2.1.0 and 2.1.1 pick not-really-installed WindowsApps python on Windows 11
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
Description
After installing poetry 2.1.x I cannot run commands like "poetry env use ..." or "poetry new ...". I do not have a working "python" in PATH so WindowsApps version is used - it just opens Windows Store when called directly. For reasons I have the "py" Windows launcher working, but no real "python" command in PATH.
Apparently before 2.1.x Poetry used the environment that it was installed to to do Poetry things and it worked for me really well, so I'm reporting this as a bug.
Thank you for your work :)
Workarounds
I guess I could add some real python to PATH, but I didn't have to do that until now.
Poetry Installation Method
pip
Operating System
Windows 11
Poetry Version
Poetry (version 2.1.1)
Poetry Configuration
cache-dir = "[my_personal_path]"
data-dir = "[my_personal_path]"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = "{data-dir}\\python"
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"
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false
Python Sysconfig
No response
Example pyproject.toml
Poetry Runtime Logs
INFO: Could not find files for the given pattern(s).
Stack trace:
14 ~\nosync\code\python\poetry_venv\Lib\site-packages\cleo\application.py:327 in run
exit_code = self._run(io)
13 ~\nosync\code\python\poetry_venv\Lib\site-packages\poetry\console\application.py:260 in _run
exit_code = super()._run(io)
12 ~\nosync\code\python\poetry_venv\Lib\site-packages\cleo\application.py:431 in _run
exit_code = self._run_command(command, io)
11 ~\nosync\code\python\poetry_venv\Lib\site-packages\cleo\application.py:473 in _run_command
raise error
10 ~\nosync\code\python\poetry_venv\Lib\site-packages\cleo\application.py:457 in _run_command
exit_code = command.run(io)
9 ~\nosync\code\python\poetry_venv\Lib\site-packages\cleo\commands\base_command.py:117 in run
return self.execute(io) or 0
8 ~\nosync\code\python\poetry_venv\Lib\site-packages\cleo\commands\command.py:61 in execute
return self.handle()
7 ~\nosync\code\python\poetry_venv\Lib\site-packages\poetry\console\commands\new.py:86 in handle
return self._init_pyproject(
6 ~\nosync\code\python\poetry_venv\Lib\site-packages\poetry\console\commands\init.py:176 in _init_pyproject
+ Python.get_preferred_python(config, self.io).minor_version.to_string()
5 ~\nosync\code\python\poetry_venv\Lib\site-packages\poetry\utils\env\python\manager.py:277 in get_preferred_python
f"Found: {active_python.executable}", verbosity=Verbosity.VERBOSE
4 ~\nosync\code\python\poetry_venv\Lib\site-packages\poetry\utils\env\python\manager.py:171 in executable
return cast(Path, self._python.interpreter)
3 ~\nosync\code\python\poetry_venv\Lib\site-packages\findpython\python.py:80 in interpreter
self._interpreter = Path(self._get_interpreter())
2 ~\nosync\code\python\poetry_venv\Lib\site-packages\findpython\python.py:217 in _get_interpreter
return _run_script(str(self.executable), script).strip()
1 ~\nosync\code\python\poetry_venv\Lib\site-packages\findpython\python.py:23 in _run_script
return subprocess.run(
CalledProcessError
Command '['C:\Users\user\AppData\Local\Microsoft\WindowsApps\python.EXE', '-EsSc', 'import sys; print(sys.executable)']' returned non-zero exit status 9009.
at ~\AppData\Local\Programs\Python\Python313\Lib\subprocess.py:579 in run
575│ # We don't call process.wait() as .exit does that for us.
576│ raise
577│ retcode = process.poll()
578│ if check and retcode:
→ 579│ raise CalledProcessError(retcode, process.args,
580│ output=stdout, stderr=stderr)
581│ return CompletedProcess(process.args, retcode, stdout, stderr)
582│
583│
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Python selection from poetry/console/commands/new.py and init.py through poetry/utils/env/python/manager.py into findpython/python.py. Reproduce the Windows 11 failure with a WindowsApps python alias and a working py launcher, then verify that commands such as poetry env use and poetry new no longer select the non-working interpreter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100