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

Java complications when loading lifs #15

Open
iainmuntz opened this issue May 23, 2022 · 5 comments
Open

Java complications when loading lifs #15

iainmuntz opened this issue May 23, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@iainmuntz
Copy link
Collaborator

iainmuntz commented May 23, 2022

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
Copy link
Member

mwakok commented May 23, 2022

@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
Copy link
Member

mwakok commented May 25, 2022

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:

  • I found that the additional step to update the loci_tools.jar file via pims.bioformats.download_jar(version='6.5') is being addressed in this PR. When this is released, the required file will be downloaded automatically and this step should no longer be required.
  • This warning can (for now) be suppressed by specifying the read_mode when loading the image with pims, i.e. pims.Bioformats(file, read_mode='jpype')

@mwakok mwakok added the bug Something isn't working label May 25, 2022
@iainmuntz
Copy link
Collaborator Author

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
Copy link
Collaborator Author

iainmuntz commented Jun 9, 2022

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
Copy link
Member

mwakok commented Jun 16, 2022

Add section Troubleshooting and add link to this issue

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

No branches or pull requests

2 participants