I am trying to connect a headless imageJ library to my python application. Unfortunately, the dependency error list goes on endless and I am now stuck at an import error involving the import of a java wrapper called jnius.
So far I have installed: wheel, imagej, cython, imglyb, pyjnius modules using an updated pip. Since the "Unable to determine JDK_HOME" was triggered in between, I followed the obvious rules of updating environment Variable list to my paths (both user and system). In between, pyjnius reported "Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools"
and I installed the same (a hefty 5.63 GB) and additionally the "VCForPython27".
import os
print(os.environ.get('JAVA_HOME'))
print(os.environ.get('JDK_HOME'))
both the command gives me the following output:
C:\Program Files\Java\jdk-11.0.2; C:\Program Files\Java\jdk-11.0.2\bin;C:\Program Files\Java\jdk-11.0.2\bin\server
Now I can import imageJ in my code, but when I try to use its first function
ij = imagej.init('C:\\Users\\Documents\\ImageJ_Fiji\ImageJ-win64.exe')
I get the following error associated with import scyjava
as: "Unable to import scyjava dependency jnius."
and when I try to run pip install jnius --user
I get the same old error: "Unable to determine JDK_HOME'" which seems confusing since I had successfully installed pyjnius
and a pip install scyjava --user
gives me an output that all requirements are satisfied.
I am no longer using a conda environment (since it got me very confusing), my python version is 3.7.2 and my OS is windows 10. The editor I use is PyCharm. I have installed the latest JDK and JRE from oracle website.
Referance: Jnius installation bug, "Unable to determine JDK_HOME" jnius 1.1 import error