Search code examples
javapythonjava-8imagejminiconda

pyimagej setup + conda: No Java runtime present, requesting install


Problem

I'm trying to use pyimagej==0.4.0 (source). Per its README, I run the following code:

import imagej
ij = imagej.init()

And it returns the following error: No Java runtime present, requesting install.

I looked up this error in multiple articles:

Both articles say I need the full JDK, not just the JRE. However, I think I have the full JDK.

Background

  • pyimagej==0.4.0
  • macOS Mojave v10.14.3
  • miniconda 4.6.14

Set up conda environment with:

  1. conda create -n pyimagej pyimagej openjdk=8
  2. conda activate pyimagej

Checking environment:

(pyimagej) ➜  fiji_test java -version
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (Zulu 8.33.0.1-macosx) (build 1.8.0_192-b01)
OpenJDK 64-Bit Server VM (Zulu 8.33.0.1-macosx) (build 25.192-b01, mixed mode)
(pyimagej) ➜  fiji_test echo $JAVA_HOME
/usr/local/Caskroom/miniconda/base/envs/pyimagej

Can you please fill in what am I missing? Thank you in advance for any advice.


Solution

  • Well it turns out the problem was quite in the weeds.

    It seems this problem was encountered by one of pyimagej's developers here: https://github.com/imagej/pyimagej/issues/10

    The developer posed a short-term workaround of directly modifying the jdk's Info.plist.

    The developer also opened a PR for a more long-term solution. Hopefully it gets closed, and then hopefully no one else will encounter this! :)