jep icon indicating copy to clipboard operation
jep copied to clipboard

Trouble installing jep via pip [python 3.11.4]

Open Nathan22211 opened this issue 1 year ago • 7 comments

Describe the problem jep fails to install via pip in python 3.11

Search for existing solutions The Jep build is automatically tested and confirmed to be working in Linux, OS X, and Windows using Travis and AppVeyor. We cannot possibly test every environment so we rely on the community to document any issues and solutions in other environments. Please search for a similar problem and solution on both the mailing list and the existing closed github issues before opening a new issue.

Environment (please complete the following information):

  • OS Platform, Distribution, and Version: windows 11
  • Python Distribution and Version: 3.11.4 from python website
  • Java Distribution and Version: Java SE 17 and 20 are installed
  • Jep Version: 4.1.1
  • Python packages used (e.g. numpy, pandas, tensorflow): install trouble so probably not relevant

Logs ` Using cached jep-4.1.1.tar.gz (3.0 MB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [2 lines of output] Error: Please set the environment variable JAVA_HOME to a path containing the JDK. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.`

Additional context I have 2 java versions installed, one for Minecraft, as there's a mod that uses jep, and one for general development

Nathan22211 avatar Jul 11 '23 21:07 Nathan22211

Please set the environment variable JAVA_HOME to a path containing the JDK.

bsteffensmeier avatar Jul 11 '23 21:07 bsteffensmeier

Is that doable per pipvenv? I might need to use a different version of java in one project from the version used for the minecraft mod

Nathan22211 avatar Jul 11 '23 23:07 Nathan22211

When you install jep it needs to build the native library using the JNI headers included with your JVM so it needs to know where java is installed. I don't have much experience with pipvenv but if you install jep separately into a different venv then it could use different java installation during installation. I also believe the JNI headers are usually compatible so you may be able to use the same native library with different java installations but it isn't something I have done before so I cannot say with 100% certainty what will work in your environment.

bsteffensmeier avatar Jul 11 '23 23:07 bsteffensmeier

When you say the environment variable, is that a python variable of some sort or a system variable? I've never used env variables in Python before 😅

Nathan22211 avatar Jul 12 '23 00:07 Nathan22211

It is a system variable, I don't develop jep on windows so I don't have instructions on how to set it but it is a common setting for java apps so you should be able to find help online, for example these instructions look accurate to me.

bsteffensmeier avatar Jul 12 '23 14:07 bsteffensmeier

I have set the JAVA_HOME and I am getting a new error

/opt/conda/compiler_compat/ld: cannot find -ljvm: No such file or directory
      collect2: error: ld returned 1 exit status
      error: command '/usr/bin/gcc' failed with exit code 1

Could anyone tell me what is going wrong ?

goldenretriever98 avatar Jul 26 '23 16:07 goldenretriever98

@goldenretriever98, the error message means it can't find libjvm. Are you on macOS or Linux? Check the directory $JAVA_HOME/lib for libjvm.dylib on macOS or libjvm.so on Linux. If it's not there maybe you have locate enabled and could do locate libjvm to try and find it and change the JAVA_HOME environment variable accordingly.

ndjensen avatar Jul 26 '23 18:07 ndjensen