8

I am a newbie to Python. I just installed Python (anaconda python 2.7) and while launching Anaconda prompt something happened which was "failed to create process"

enter image description here

So can anyone here help me out please? I appriciate every help.

Stefan Pochmann
  • 27,593
  • 8
  • 44
  • 107
khuongngoc
  • 339
  • 1
  • 3
  • 8
  • This could be totally off, but sometimes I get a similar-reading error from a different program when my computer's running out of memory or something. Restarting the computer fixes it. Have you tried that? – qxz Feb 10 '17 at 06:12
  • oh your comment recalls me in the installing process. a prompt came up like "clear up space.. and something. is that problem? – khuongngoc Feb 10 '17 at 06:15
  • i tried that out but the problem has not been resolved – khuongngoc Feb 10 '17 at 06:21
  • 1
    That's an error from the setuptools EXE stubs. They don't handle paths with spaces properly. IIRC these executables don't embed the script, but instead run a [name]-script.py file that's beside them. If you find the script, it may solve the problem if you add quotes around the shebang command that's on the first line. – Eryk Sun Feb 10 '17 at 08:22
  • Ultimately setuptools needs to switch to the same distlib EXE wrappers that pip uses for entry points when installing wheel packages. Vinay Sajip (the author of distlib and original author of Python's "py" launcher) actively maintains distlib, plus it would just be more consistent in general. – Eryk Sun Feb 10 '17 at 08:24
  • I just restarted my laptop and this error went away, I hadn't restarted after installing Anaconda. – John Youngtree Sep 22 '22 at 17:04

5 Answers5

10

I encountered the exact same error, because my username included a space. ("C:\Users\Ben Ji") The easiest solution is to install Anaconda to another folder in the Users-folder, e.g. public.

(The same error occurs when using pip, check out https://stackoverflow.com/a/35275384/6580199)

Benji
  • 549
  • 7
  • 22
  • Same issue, no space in my path, though.My solution was to reinstall anaconda on smaller path. From C:\Users\\AppData\Local\Continuum\Anaconda\Anaconda3 to C:\anaconda3. Also, I do not have admin privileges on my computer. – Ricardo Rivaldo Oct 04 '18 at 15:41
5

Anaconda uses an executable that starts Python with a script. The executable retrieves its own name, strips off ".exe" and post-pends "-script.py". In that script file, check the first line of the script corresponding to the command. It should have a she-bang pointing at the correct Python executable, something like:

#!C:/ProgramData/Anaconda3/python.exe

You can use forward and back slashes interchangeably in this line. If the link points to the wrong place, you'll get "failed to create process." If the link needs spaces, you can put it in double-quotes, like this:

#!"C:/Users/My special name/my special place/python.exe"

Single quotes and back slash escape on spaces don't seem to work for the executable path,... go figure.

Note that if you don't coordinate the name of the executable file with the name of the script, you'll get a "Cannot open" error rather than "failed to create process."

Frank M
  • 1,550
  • 15
  • 15
  • 'Anaconda uses an executable that starts Python with a script' . What is the specific name of the script? – addcolor Mar 19 '20 at 05:20
  • The executable has an exe extension. Most of the exe files are the same (same length, same checksum). When the exe file runs, it determines its name, then uses that to determine the name of the script. For example, ipython.exe runs ipython-script.py. pylint.exe is identical to ipython.exe, but runs pylint-script.py because it has a different name. – Frank M Apr 13 '20 at 20:46
4

I tried installing as administrator and it worked. Right click on installer and 'Run as administrator'.

addcolor
  • 455
  • 8
  • 23
0

I tried the above methods, but it didn't work. Then I uninstalled and reinstalled the anaconda. Now, It works fine.

0

I tried installing anaconda for all user and it worked for me!!

The Basic reason for this issue is having space in our username.

Aravind
  • 31
  • 5