AttributeError: module 'bioformats' has no attribute 'get_omexml_metadata'

Hello everyone! (newbie here)


macOS Mojave 10.14
python-bioformats 1.5.2
Pycharm 2019.2


Experimenting around with different tools. I am currently trying to create an ometiff file with 2 Series by reading and combining 2 jpg files at different resolutions.

I did install both bioformats and javabridge and my IDE recognizes them. I have an older project which uses all these tools and it works like a charm.


However in my current project when I run the code I get aforementioned error.
In Pycharm it also says this: “Cannot find reference ‘get_omexml_metadata’ in ‘’”.

Here is the code:

import bioformats

import skimage
from skimage.external import tifffile

def execute(image_1, image_2):
    """ Main """

    # Get Omexml
    omexml_1 = bioformats.get_omexml_metadata(image_1)
    omexml_1 = omexml_1.encode('utf-8')
    omexml_1 = omexml_1.replace('\n      <MetadataOnly/>', '\n      <TiffData/>')

    data_1 =
    data_2 =

    file_name = 'temp.ome.tiff'
    with tifffile.TiffWriter(file_name) as tif:, photometric='minisblack', description=omexml_1, metadata={'axes': 'TZCXY'}), photometric='minisblack', metadata={'axes': 'TZCXY'}, contiguous=False)

if __name__ == "__main__":
    execute("input/moscow_100.jpg", "input/moscow_25.jpg")


Where is the problem coming from - code, IDE, other ?

Thank you in advance for your help!

It may be that you need to enable javabridge as part of the initialisation:

Thank you for the reply!

I have added the following 3 lines accordingly to my script:

import javabridge

However I still get an error of the same type:

AttributeError: module ‘bioformats’ has no attribute ‘JARS’

rather than bioformats.JARS if you point to the jar location does that solve the issue? You would need to change the location listed below:

BFPATH = r'bfpackage/bioformats_package.jar'
jars = javabridge.JARS + [BFPATH]

Seems I found the answer:

It worked before on the other project because I was using dockers, so there it ran once.
I created another image based on this current project and this time it worked.