question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry shell in git bash on Windows broken since 1.2.0

See original GitHub issue
  • [x ] I am on the latest Poetry version.
  • [x ] I have searched the issues of this repo and believe that this is not a duplicate.
  • [ x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 11, git 2.33.1.windows.1
  • Poetry version: 1.2.0
  • Link of a Gist with the contents of your pyproject.toml file: Not relevant

Issue

Since poetry 1.2.0, poetry shell does not work on git bash in Windows.

$ poetry shell
Spawning shell within C:\Users\filip\AppData\Local\pypoetry\Cache\virtualenvs\dinrplan-9Ih6xyvL-py3.10
/usr/bin/bash: /K: No such file or directory

Downgrading to 1.1.5 works:

filip@Marwin MINGW64 ~/workspace/python/dinrplan (master)
$ poetry --version
Poetry version 1.1.15

filip@Marwin MINGW64 ~/workspace/python/dinrplan (master)
$ poetry shell
Spawning shell within C:\Users\filip\AppData\Local\pypoetry\Cache\virtualenvs\dinrplan-T1RTjXIi-py3.9

filip@Marwin MINGW64 ~/workspace/python/dinrplan (master)
$ which python
/c/Users/filip/AppData/Local/pypoetry/Cache/virtualenvs/dinrplan-T1RTjXIi-py3.9/Scripts/python

Looking at the code, I believe 57450f2717 broke the git bash support.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rcludwickcommented, Oct 6, 2022

@cbehopkins

From previous poetry brokenness, I ended up having a shell alias to do the right thing.

alias pshell='poetry run bash -i'

You can also hardcode which bash you want to run if you want to run.

Keep in mind that at least in my case, on Windows, poetry changed the virtual env it installs to. So if you were using 1.1.15 and upgraded to 1.2.0 or later, you’ll want to check to make sure your IDE points to the right virtualenv for your python interpreter.

0reactions
bmarroquincommented, Sep 16, 2022

The identification point is correct. For windows, we are only considering Powershell or cmd.exe. I’ll add a third case to fallback to the previous behavior. The prompt modification won’t happen in this situtation.

Here is what shellingham reports

$ .venv/Scripts/python.exe -i
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import shellingham
>>> shellingham.detect_shell()
('bash', 'C:\\Program Files\\Git\\usr\\bin\\bash.exe')
Read more comments on GitHub >

github_iconTop Results From Across the Web

`Latest version already installed` but `poetry: command not ...
Completely wiped my PC,; Tried Anaconda and Miniconda versions (installing and uninstalling),; Setup Conda with Git Bash,; Experimented with WSL ...
Read more >
Announcing Poetry 1.2.0 | Blog
Since there are many changes in Poetry 1.2.0, this post details the changes over the following sections: Breaking changes and major features ...
Read more >
Configuration - Starship: Cross-Shell Prompt
If you are running Starship in bash , do not hook the DEBUG trap after running eval $(starship init $0) , or this...
Read more >
Changelog - tmuxp 1.19.0a0 documentation
To install the unreleased tmuxp version, see developmental releases. pip: pipx: tmuxp 1.19.x (unreleased): What's new: Environment variables for windows ...
Read more >
Setting up Python Projects: Part II | by Johannes Schmidt
OS: Linux, Unix, macOS, Windows (WSL2 with e.g. Ubuntu 20.04 LTS) · Tools: python3.10, bash, git, tree, awk · Version Control System (VCS)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found