Exe launcher fails if there is a space in the path to the interpreter

Issue #47 resolved
Alex Grönholm created an issue

Steps to reproduce:

  1. Create a directory with a space in its name (e.g. "test dir")
  2. Go to that directory and create a new virtualenv (e.g. "testenv")
  3. Activate said virtualenv
  4. Try to pip install anything

Comments (13)

  1. Paul Moore

    Here's a demo:

    >cd 'C:\test dir\'
    PS 15:35 C:\test dir
    >virtualenv testenv
    Using base prefix 'C:\\Apps\\Python34'
    New python executable in testenv\Scripts\python.exe
    Installing setuptools, pip...done.
    PS 15:35 {00:10} C:\test dir
    >testenv\scripts\activate.ps1
    (testenv) PS 15:35 (testenv) C:\test dir
    >python -c "import sys; sys.executable"
    (testenv) PS 15:35 (testenv) C:\test dir
    >pip install wheel
    Fatal error in launcher: Unable to create process using '""C:\test dir\testenv\Scripts\python.exe"" "C:\test dir\testenv\Scripts\pip.exe" install wheel'
    (testenv) PS 15:35 (testenv) C:\test dir
    >python -m pip install wheel
    Downloading/unpacking wheel
    Installing collected packages: wheel
    Successfully installed wheel
    Cleaning up...
    

    Note that python -m pip works, which is what indicates to me that it's the launcher that is having the problem with the space in the path.

  2. Vinay Sajip

    Okay, it looks like a change in distlib to put quotes around paths with spaces in them is conflicting with the launcher doing the same thing - hence the double quotes. It would seem like the correct fix would be for the launcher not to add quotes if some are already there.

    BTW Alex, props for APScheduler :-)

  3. Paul Moore

    Hmm, I cannot reproduce the original issue on the PC I am using at the moment. I'll try to reproduce, and then test the fix, on Monday.

  4. Paul Moore

    OK, got it reproduced on my other PC, and this fix sorts out the issue. I'm not sure why it only happens on one of the PCs, but I guess that's less important.

    @Alex Grönholm Once we get a new distlib release, this will go into pip and then into virtualenv, so it won't appear as a resolution for your issue till then.

  5. Naiping Dong

    I just installed the latest version of python 3 (3.4.2) with latest version of pip (1.5.6) in other directory beyond the default one, same error still occurred:

    C:\Users\Elkan>pip Fatal error in launcher: Unable to create process using '""D:\program files\Pyth on34\python.exe"" "D:\program files\Python34\Scripts\pip.exe" '
    

    It was still after I replaced the .exe files (like t32, t64 etc). So, any more suggestions?
    Thanks, best regards.

  6. Vinay Sajip

    I would suggest waiting until a new version of pip comes out. AFAIK, this issue is now resolved in distlib, and it's pip that needs to incorporate the fix in a new release.

  7. Log in to comment