Bundling javabridge, bioformats, etc — how does CellProfiler do it?

cellprofiler
build

#1

Hi,

I’m writing a single-use image analysis app in Python that I would like to make super-easy for a user to install. The tutorials I could find on this don’t cover any java interactions, which I need for python-bioformats. (Thank you again!)

I tried poring over the CellProfiler setup.py and the build-from-source instructions on the wiki, but I couldn’t quite identify where the magic happens. It appears to happen in different ways in different platforms.

  • For macOS, you appear to use python setup.py py2app. But how do you control what gets bundled in the app?
  • For Windows, I presume (?) you use py2exe? But I couldn’t find any reference to it in the repo. (Nor to py2app for that matter.)
  • does the JDK get bundled?
  • either way, how do you specify the JAVA_HOME used by the app on each platform?

Thanks!

Juan.


#2

We switched from Py2App to PyInstaller with CellProfiler 3.0. PyInstaller manages the process of creating the executable and both bundling and linking libraries. The process is similar for both macOS and Windows. You can find the needed configuration in the CellProfiler/distribution repository.

We don’t bundle the JDK or specify JAVA_HOME, hence the many many Java install issues here on the forum :slight_smile:


#3

Thanks @bcimini! I’m not sure why I struggled to find that repo…!

But, great news that you switched to PyInstaller, because I saw a few comments on the broader web that Py2app appears to be unmaintained, so it makes me happy to find a battle-tested example of cross-platform PyInstaller use.

The process doesn’t seem too complicated on Mac, except for this line, wth is going on here? LOL
cp $(word 3, $^) $@/Contents

This also seems to actually contradict your statement that the java runtime isn’t bundled?

Finally, what are the arguments to exclude_binaries? I can’t find any documentation online about this! But it seems important. =P

Thanks!