Search code examples
windowscmdmsysgitgit-bashvirtualenvwrapper

Using virtualenvwrapper-win in msysgit (sh.exe": mkvirtualenv: command not found), works in normal cmd


I have trouble setting up my virtualenv to work correctly in windows.

I'm using the latest (1.9) msysgit console to do my normal work and installed virtualenv, virtualenvwrapper and virtualenvwrapper-win via pip. It works correctly in the normal cmd, but msysgit just displays

sh.exe": mkvirtualenv: command not found

I can use the normal virtualenv, but it's cumbersome and additionally ignores my set variables of %WORKON_HOME% and %PROJECT_HOME% to seperate my envs and projects folder. Both works in cmd.exe.

Any idea?


Solution

  • The problem is that msysgit is not a full MSYS install. It only contains what is necessary for git to work. You have a few options: (1) Install the full, real MSYS/MINGW32 environment (not recommended why have two copies installed) or (2) install the missing piece(s).

    Depending on which version of msysgit you have installed the missing pieces seem to vary, but at the very least you need to download a copy of mktemp.exe. Some users have reported also needing fmt.exe.

    You may need to create a "MSYSTEM" environment variable and set it to the string "MINGW32" (which should tell virtualenvwrapper to configure paths for windows even though being run from a unix shell -- i.e.: Scripts dir instead of bin dir). And "MSYS_HOME" should be set to where msysgit is installed (perhaps add the line export MSYS_HOME = /c/Program\ Files\ \(x86\)/Git to .bashrc). I don't recall offhand if the msysgit installer sets these correctly (or at all).