-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Description
The eval $(poetry env activate) command does not work in Windows when running it in a Bash shell (or similar), because it does not output . or source at the beginning. Instead the command outputs only the single-quoted path to the activate script, which is meant to be used as argument to Powershell's Invoke-Expression command.
The poetry env activate command should behave the same way, regardless of the operating system, especially for any shells other than Powershell and cmd.
The reason is because of an if WINDOWS: line in poetry.console.commands.env.activate module, which actually only works for Powershell (but nothing can be done for cmd). One simple way to fix this would be to set command to "" for the ["powershell", "pwsh"] and "cmd" cases and test if not command: instead of testing if it's Windows or not.
Workarounds
A workaround is to add a . (or source) after eval: eval . $(poetry env activate)
Poetry Installation Method
pipx
Operating System
Windows
Poetry Version
2.1.3
Poetry Configuration
Not relevantPython Sysconfig
sysconfig.log
Not relevant
Example pyproject.toml
Poetry Runtime Logs
poetry-runtime.log
Not relevant