OS: Windows 7, 64-bit
Here I learn that the latest version of Jython (downloads/installs as \"2.7.0\") includes the \"ensurepip\" module, which hopefully installs pi
I also installed the Jython and was facing the same error after setting the JAVA_HOME to C:\Program Files\Java\jdk-10.0.2 works for me.
JAVA_HOME
must be set such that %JAVA_HOME%\bin\java.exe
is the Java executable, and the target java.exe must be Java 7. See this Jython bug. It is important to note that some other possible settings for that environment variable do not work - we expect that bin\java.exe
can be joined to JAVA_HOME
(using os.path.join
to be precise). Also it is important to set JAVA_HOME
exactly per what Windows expects in terms of quoting, etc:
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_55
but not
set JAVA_HOME="C:\Program Files\Java\jdk1.7.0_55"
(Not at all the same! Just try it to see what I mean.)
The easiest way to debug these problems is with jython --print; for example on my system I get the following:
C:\jython2.7.0>set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_55
C:\jython2.7.0>bin\jython.exe --print
"C:\Program Files\Java\jdk1.7.0_55\bin\java" -Xmx512m -Xss1024k -classpath C:\jython2.7.0\jython.jar;. -Dpython.home=C:\jython2.7.0 -Dpython.executable=C:\jython2.7.0\bin\jython.exe -Dpython.launcher.uname=windows -Dpython.launcher.tty=true org.python.util.jython
Let me next explain the opaque error you are seeing. There are two things going on:
jython.exe is actually the Jython launcher; the real Jython we use is seen in the output of jython --print
; it is org.python.util.jython
, plus a bunch of other options. But we need an exe so that pip and other tooling can work. On Windows (or on other OSes if profiling for example is turned on), the launcher uses subprocess to invoke the Java executable. This subprocess invocation is in line 435 of jython.py.
Yes, that's jython.py. It actually uses CPython 2.7 (thanks for being around CPython, we like you!), and is wrapped into an executable by PyInstaller. The whole thing about "Z:\jythondev\jython27\src\shell\build\jython\out00-PYZ.pyz\subprocess", is due to the fact that I built jython.exe on my Z: drive, onto which my install of Windows 8.1 on VMWare has mapped my OS X homedir. (Yes, I'm completely responsible for this build.) Next, out00-PYZ.pyz refers to some internal scheme used by PyInstaller.
We need to complete the release notes wiki update I mention on that bug! And of course fix that bug so it provides a better error message and possibly can recover in certain cases.