Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jpy will not build on Mac OSX if the installed JDK has a libexec directory and not a lib directory #118

Closed
chipkent opened this issue Dec 13, 2023 · 1 comment · Fixed by #119
Assignees
Labels
bug Something isn't working

Comments

@chipkent
Copy link
Member

I am attempting to install jpy into a python 3.12 development environment on Mac OSX M1. As is standard, brew is used to install most dependencies. jenv is used to switch between JDKs -- including switching JAVA_HOME.

Case 1 -- zulu64-21.0.1 JDK (BUILD WORKS)

Here the Zulu JDK was installed from https://www.azul.com/downloads/?package=jdk#zulu.

jenv add /Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home
jenv global zulu64-21.0.1

The directory structure of Zulu is:

(venv12_newos) ➜  test_avi_4839 ls $JAVA_HOME/
DISCLAIMER   Welcome.html bin          conf         demo         include      jmods        legal        lib          man          readme.txt   release

Note that there is a lib directory and no libexec directory.

(Run these lines one at a time so that env vars get set right)

deactivate
jenv global zulu64-21.0.1
rm -rf ./venv_zulu
python3.12 -m venv ./venv_zulu
source ./venv_zulu/bin/activate
pip cache purge
pip install jpy

It works:

Collecting jpy
  Using cached jpy-0.14.0-cp312-cp312-macosx_12_0_arm64.whl
Installing collected packages: jpy
Successfully installed jpy-0.14.0

Case 2 -- OpenJDK@17 (BUILD FAILS)

Here OpenJDK@17 is installed using brew install openjdk@17.

brew install openjdk@17
jenv add /opt/homebrew/opt/openjdk@17/
jenv global 17.0.9

The directory structure of OpenJDK is:

(venv12_newos) ➜  test_avi_4839 ls $JAVA_HOME/
INSTALL_RECEIPT.json  LICENSE               README.md             bin/                  include/              libexec/              share/

Note that there is a libexec directory and no lib directory.

(Run these lines one at a time so that env vars get set right)

deactivate
jenv global 17.0.9
rm -rf ./venv_ojdk
python3.12 -m venv ./venv_ojdk
source ./venv_ojdk/bin/activate
pip cache purge
pip install jpy

It fails:

Collecting jpy
  Downloading jpy-0.14.0.tar.gz (172 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 172.2/172.2 kB 1.4 MB/s eta 0:00:00
  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
  ╰─> [1 lines of output]
      Error: environment variable "JAVA_HOME" must be set to a JDK (>= v1.7) installation directory
      [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.

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

In this case when jpy tries to build against OpenJDK, it claims JAVA_HOME is not set.

Soruce of the problem

The error message is coming from

jpy/setup.py

Line 104 in 14b19a7

log.error('Error: environment variable "JAVA_HOME" must be set to a JDK (>= v1.7) installation directory')
because jdk_home_dir is None. This is coming from

jpy/jpyutil.py

Line 143 in 14b19a7

and os.path.exists(os.path.join(jdk_home_dir, 'lib')):
. Here there is a requirement that there be a lib dir without also checking for a libexec dir.

@chipkent chipkent added the bug Something isn't working label Dec 13, 2023
@chipkent chipkent assigned jmao-denver and chipkent and unassigned jmao-denver Dec 13, 2023
@devinrsmith
Copy link
Member

I think there are also more fundamental 3.12 concerns that need to be addressed too - see #115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants