maybe someone has seen this..
fairly old Mac OS which might cause this, but mostly everything works OK:
- Mac OS 10.14.6 (18G9323)
- LiClipse 8.1.0.202110030926 com.brainwy.liclipse.rcp.product null
- Homebrew freshly updated (even though also complains OS is too old) and some packages reinstalled to make sure it's all cleared
$ pyenv versions
system
3.9.5
* 3.9.7 (set by /Users/aanisimov/.pyenv/version)
$ which python
/Users/aanisimov/.pyenv/shims/python
$ python --version
Python 3.9.7
LiClipse just cannot find it! tried all these buttons there (PATH, pip, what not) still the same error:
Errors getting info on discovered interpreter(s).
See error log for details.
java.lang.RuntimeException: java.io.IOException: Cannot run program "/usr/bin/python": error=0, posix_spawn failed
java.lang.RuntimeException: java.io.IOException: Cannot run program "/usr/bin/python2.7": error=0, posix_spawn failed
java.lang.RuntimeException: java.io.IOException: Cannot run program "/usr/local/bin/python3": error=0, posix_spawn failed
java.lang.RuntimeException: java.io.IOException: Cannot run program "/usr/local/bin/python3.9": error=0, posix_spawn failed
looks like it is trying to find it in most obvious locations, but unable to spawn the process to run it?
Python works OK via terminal and things like Sublime Text.
Thanks for any advice!
I had a problem very much like this, except with LiClipse version 8.2.0, running on macOS 12.4 Monterey, with Python interpreters installed by MacPorts. The symptoms were similar, except that LiClipse returned error code 316 instead of 0. What I wanted to know: how can I resolve this problem, so that LiClipse can add new interpreter entries in PyDev, and not display errors?
I came up with a workaround. I don't fully understand why it works, but I have some clues.
Workaround:
Install a standard Eclipse app of the same vintage (Eclipse 2021-12, version 4.22, corresponds to LiClipse 8.2.0).
Quit LiClipse.
Using a plain text editor, edit the file within LiClipse.app,
LiClipse.app/Contents/Eclipse/LiClipse.ini. Change the lines in that file which read:to read (of course replacing
<myuserid>with your home directory name, and no line break in the very long line starting "/Users/"…):save LiClipse.ini.
run LiClipse.app. It should now be able to add new interpreter entries in PyDev, with no errors.
delete the Eclipse.app. (This should leave behind /Users//.p2/ undisturbed.)
What it does:
I am not an expert on the internals of either LiClipse or Eclipse. What I think is happening is that Eclipse supplies an OpenJDK for the app to run, it is different than the OpenJDK supplied by LiClipse, and it supports recent version of macOS better. Evidence of difference:
The
LiClipse.inifile controls how the app starts up. macOS runs a launcher program, and the launcher is guided by the contents of the ini file. The inserted lines look to me like they tell the launcher to specify a different Java VM to use when running the main Eclipse/LiClipse application — to use the OpenJDK 18.0.1 supplied by Eclipse, saved in~/.p2/, instead of the OpenJDK 14.0.2 supplied by LiClipse; and also to invoke a librarylibjli.dylib.Clues about the cause
I don't know enough about the JDK to know what library
libjli.dylibdoes. There are clues in a StackOverflow answer, What is the Java libjli library for?, and in a blog post, Calling Java From C. It looks like it helps interaction between the Java VM environment and the hosts's native language environment. The StackOverflow reply mentions,The error message in my case read,
I speculate that LiClipse was trying to call macOS to run the Python interpreter, but this attempt failed because the Java VM environment could not call the host's native environment successfully.
The change to LiClipse.ini means that LiClipse uses a different OpenJDK, and invokes libjli differently. The combination of these differences seems to let the Java VM environment succeed in calling the host's native environment.
I speculate that a proper fix requires an update to LiClipse. I have opened ticket 239, 8.2.0 cannot run pythons and pips, "java.io.IOException: Cannot run program"... error=316, posix_spawn failed, to track it.