Building QuPath with StarDist from source using Docker


I am have been trying to build QuPath v0.2.3 with tensorflow and StarDist from source, using adoptopenjdk-14-hotspot. I got to a similar stage as other users in this issue.

I can build from source, but two tests still fail. I was wondering if you would be able to provide advice on how to get the tests to pass. Hopefully the dockerised tool will be useful for others too!

Best wishes,

FROM debian:buster

# docker build -t qupath:latest -t qupath:v0.1 .
# docker tag qupath:v0.1 ivazquez/qupath:v0.1
# docker tag qupath:latest ivazquez/qupath:latest
# docker push ivazquez/qupath:v0.1
# docker push ivazquez/qupath:latest

RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y sudo tree wget git && \
    apt-get install -y gnupg2

ENV DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket

RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y binutils && \
    apt-get install -y unattended-upgrades && \
    apt-get install -y dbus-x11 && \
    apt-get install -y software-properties-common && \
    wget -qO - | sudo apt-key add - && \
    sudo add-apt-repository -y && \
    apt-get update && \
    sudo apt-get install -y adoptopenjdk-14-hotspot && \
    export JAVA_HOME=/usr/lib/jvm/adoptopenjdk-14-hotspot-amd64/

# QuPath source with tensorflow
RUN export DISPLAY=:0.0 && \ 
    git clone --branch v0.2.3 && \
    cd qupath && \
    ./gradlew clean build createPackage -x test -Ptensorflow-cpu=true

USER root

Was the error the same (i.e. something about JavaCPP/OpenCV)?

If so, perhaps this is relevant: Possible to do a headless packaging of OpenCV and FFmpeg? · Issue #593 · bytedeco/javacpp-presets · GitHub

If not, what errors do you see?

The tests that fail seem to be related to ImageWriterIJTest.

> Task :qupath-core:test

ImageWriterIJTest > testWriters() FAILED
    java.awt.AWTError at

WrappedBufferedImageServerTest > test() FAILED
    java.lang.NoClassDefFoundError at
46 tests completed, 2 failed
> Task :qupath-core:test FAILED
FAILURE: Build failed with an exception.

* What went wrong:
e[0me[91mExecution failed for task ':qupath-core:test'.
> There were failing tests. See the report at: file:///qupath/qupath-core/build/reports/tests/test/index.html

e[0me[91m* Try:
Run with --stacktrace option to get the stack trace. Run with e[0me[91m--infoe[0me[91m or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at e[0me[91m
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.

Ah, in that case it seems to be missing dependencies associated with Java AWT.

Searching for java awt noclassdeffounderror or similar might help identify what is missing. I’m not sure what other problems might emerge – QuPath isn’t really intended for use without a GUI (or at least I haven’t explored how much it can be stripped back to work without one).