koenderinklab / OpenDDM

https://koenderinklab.github.io/OpenDDM/
Apache License 2.0
3 stars 2 forks source link

Java complications when loading lifs #15

Open iainmuntz opened 2 years ago

iainmuntz commented 2 years ago

When trying to run pims.Bioformats to open a .lif file I get an error about environment variables, can we resolve this in-line.

In the meantime I will continue to look for other solutions for loading .lif files.

See imageLoading.ipynb in branch iMuntz/imageLoad

Error message

---------------------------------------------------------------------------
JVMNotFoundException                      Traceback (most recent call last)
Input In [3], in <cell line: 1>()
----> 1 pims.Bioformats('data/21-03-31_ddm.lif')

File C:\Programs\Anaconda3\envs\ddm_env\lib\site-packages\pims\bioformats.py:342, in BioformatsReader.__init__(self, filename, meta, java_memory, read_mode, series)
    340 else:
    341     startJVM_kwargs = {}  # convertStrings kwarg not supported for earlier jpype versions
--> 342 jpype.startJVM(jpype.getDefaultJVMPath(), '-ea',
    343                '-Djava.class.path=' + loci_path,
    344                '-Xmx' + java_memory, **startJVM_kwargs)
    345 log4j = jpype.JPackage('org.apache.log4j')
    346 log4j.BasicConfigurator.configure()

File C:\Programs\Anaconda3\envs\ddm_env\lib\site-packages\jpype\_jvmfinder.py:74, in getDefaultJVMPath()
     72 else:
     73     finder = LinuxJVMFinder()
---> 74 return finder.get_jvm_path()

File C:\Programs\Anaconda3\envs\ddm_env\lib\site-packages\jpype\_jvmfinder.py:212, in JVMFinder.get_jvm_path(self)
    210 if jvm_notsupport_ext is not None:
    211     raise jvm_notsupport_ext
--> 212 raise JVMNotFoundException("No JVM shared library file ({0}) "
    213                            "found. Try setting up the JAVA_HOME "
    214                            "environment variable properly."
    215                            .format(self._libfile))

JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.
mwakok commented 2 years ago

@iainmuntz I don't have access to a .lif file. Could you upload one to Teams or point to one on the group drive?

mwakok commented 2 years ago

I have just tested the notebook and was able to use the pims library to load a .lif file after installing pims and jpype1 with conda. As your error mentions the lack of a Java environment variable, can you check whether java is properly installed or perhaps reinstall it? Alternatively, this guide provides a possible solution.

Two other observations:

iainmuntz commented 2 years ago

You are correct that the java install wasn't as it should have been. I have fixed this on my ubuntu machine but need to check later if it will be OK on my windows PC

iainmuntz commented 2 years ago

After installing java 64 bit version the import line now works on Windows.

I had set up the JAVA_HOME and path variables already so not sure if that is completely necessary - maybe someone else can test?

mwakok commented 2 years ago

Add section Troubleshooting and add link to this issue