Gotcha: pyenv-win shims messing with global packages
Cleaned up my Python set-up recently with pipx and pyenv-win recently and unknowingly broke git-remote-codecommit
.
This is the error you may see:
% git clone codecommit::us-west-2://some-project
Cloning into 'some-project'…
'Scripts' is not recognized as an internal or external command,
operable program or batch file.
Initially, I thought I messed up my %PATH%
as I also happened to clean up my environment variables, profiles and RC files. Turned out the culprit was a local git-remote-codecommit
in one of the Python installations:
$ find pyenv-win/versions -name "git*remote*codecommit"
pyenv-win/versions/3.9.2/Lib/site-packages/git_remote_codecommit
The installation would cause pyenv-win
to place a few shims whenever rehash
is called, and therefore throwing the aforementioned error whenever Git process accesses git-remote-codecommit
outside of — in this case — the 3.9.2
shell.
The fix is easy: get rid of all git-remote-codecommit
packages from all Python installations maintained by pyenv-win
and ensure that there’s a global installation that no shims can supersede, pipx
or not.
The prevention? Be careful whenever you install a package that’s meant for global.