Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Windows: "The system cannot find the file specified" #190

brandon-rhodes opened this Issue Nov 25, 2011 · 6 comments


None yet
2 participants

Whether I grab virtualenv.py lone from the repository browser, or download trunk as a ZIP and run the virtualenv.py sitting in there (thus giving it the advantage of sitting next to its files), or actually “setup.py install” the package and then run it with “python -m virtualenv” (because the script does not get created anywhere under windows with “setup.py install” and a bare Python installation?), I get the exact same error, which at this late hour of Thanksgiving I find inexplicable:

C:\>\python27\python.exe -m virtualenv v27
New python executable in v27\Scripts\python.exe
Installing setuptools.................done.
Installing pip...
  Error [Error 2] The system cannot find the file specified while executing command C : \ v 2 7 \ S c r i p t s \ p y t h o n . e x e C:\v27\Scripts\easy_instal
l-script.py C:\python27\lib\site...ort\pip-1.0.2.tar.gz
...Installing pip...done.
Traceback (most recent call last):
  File "C:\python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\python27\lib\site-packages\virtualenv.py", line 1978, in <module>
  File "C:\python27\lib\site-packages\virtualenv.py", line 810, in main
  File "C:\python27\lib\site-packages\virtualenv.py", line 922, in create_environment
    install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
  File "C:\python27\lib\site-packages\virtualenv.py", line 625, in install_pip
  File "C:\python27\lib\site-packages\virtualenv.py", line 848, in call_subprocess
    cwd=cwd, env=env)
  File "C:\python27\lib\subprocess.py", line 679, in __init__
    errread, errwrite)
  File "C:\python27\lib\subprocess.py", line 893, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified


Is this to be expected if virtualenv trunk is run under Windows? Does it indicate that my little EC2 Micro instance of Windows Server (64-bit) has something wrong with it or unconfigured that virtualenv is expecting to be present on Windows? Thanks for any pointers as to how I should investigate!

And if you are curious why I am trying to run trunk, it is because I cannot find actual virtualenv releases in any format except for .tar.gz which I cannot open on a bare Windows install.

Thanks to the help of @Theomn, I have confirmed that this error does NOT happen under 1.6.4, so it's not my Windows instance. It's you. :)


carljm commented Nov 25, 2011

Hi @brandon-rhodes - thanks for the report. Nothing comes to mind immediately (and my Windows experience is rather lacking), but I'll look into it. In the meantime, we do have our releases tagged, and so you can download a zipball for 1.6.4 from https://github.com/pypa/virtualenv/zipball/1.6.4


carljm commented Nov 25, 2011

@brandon-rhodes - I think I may have found the culprit here in a recent pull request I merged. So as to save me the hassle of spinning up a Windows machine, are you willing to try one thing for me? Can you try changing line 606 of virtualenv.py from "cmd[:0] = py_executable" to "cmd.insert(0, py_executable)"? It appears to me that the former doesn't do what its author expected, due to the iterability of strings (and this explains the oddly-spaced-out path in your traceback).

You did it! That fixed the issue completely. And, for the record, Notepad might not understand newline characters, but it does preserve them when you re-save the file. You just have to look for the text you want to alter as though your entire program is a single huge line.

@carljm carljm closed this in d3d5e62 Nov 25, 2011


carljm commented Nov 25, 2011

Oh my - I apologize for having caused you to edit something in Notepad. Thanks for the report, and the verification help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment