pythonpipmsys2msyspacman-package-manager

MSYS2: pip is not in path after installation (command not found)


I installed pip on MSYS2 using the following command in the MSYS2 shell: pacman -S mingw-w64-x86_64-python-pip (web page for the package: https://packages.msys2.org/package/mingw-w64-x86_64-python-pip)

After installing, when I try to run pip in the MSYS2 shell I get: bash: pip: command not found

For some reason, it didn't install pip anywhere in the MSYS2 system path. There is no file called "pip" in C:\msys64\usr\bin. The installation did, however, add a file called "pip" in C:\msys64\mingw64\bin. This directory is not part of the default path that MSYS2 uses.

Am I supposed to add C:\msys64\mingw64\bin to my MSYS2 PATH? More importantly, why did it install pip to a directory that isn't in PATH? Is there a reason for this annoyance?


Solution

  • As the documentation explains, the MSYS2 project consists of two sections: MinGW and MSYS proper. The differences between them are as follows:

    The mingw-w64-x86_64-python-pip package belongs to the MinGW section. In order to use it, you need to launch a MinGW shell, so that you have access to the MinGW environment used to build native Windows software. If you want to have pip available in the MSYS shell, you need to install the MSYS package python-pip.

    As for manually adding /mingw64/bin to your PATH: no, you are absolutely not supposed to do that. Mixing environments in this way is not supported; the whole point is for them to be separate.