Error with an import module jnius while using imagej in python

I am trying to connect a headless image 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 the 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

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 the oracle website.

1 Like

@ctrueden and @elevans are working hard on switching pyimagej over from pyjnius to jpype.

Quoting from another forum topic:

1 Like