Stardist2D quits QuPath

I have a problem when I run Stardist2d (tensorflow) in QuPath. It closes Qupath immediately after running. Any idea how to solve this? I’m using MacOS

Does an error message of any kind appear?
Also, did you built it using tensorflow or tensorflow-gpu? I expect that on a Mac the gpu version will not work (while the default CPU version works for me).

I didn’t get any error message. It just quits. I traced where the error occurs, and I found the issue was triggered in stardist.detectObjects(CurrentImageData, pathObjects).

I built qupath for tensorflow-cpu

Since it works fine for me on a Mac, I don’t really know how to begin to help resolve this. If you can provide a lot more information then I might spot something useful e.g.

  • when/how exactly you built QuPath
    • which branch you used (or did you just download it recently from GitHub without switching branch)
    • which Java version
    • what command line call (./gradlew ...)
  • what script you ran when the crash occurs (including which StarDist model, and the path to the model)
  • which version of macOS
  • if you’re using an Intel or new Silicon Mac
  • how much RAM you have

Usually when QuPath crashes like that on a Mac, I’d expect to see an error displayed by the operating system containing a long and obscure stack trace – which can be very useful. Similar information is seen in a hs_err file, e.g. see

I built the QuPath two days ago following the instructions in QuPath documentation

  • I recently downloaded it from Github without switching branches (main QuPath Should I use master instead?

  • Java is 14.0.2

  • I used this command./gradlew clean build createPackage -Ptensorflow-cpu=true

  • script I ran is shown below, Stardist model is he_heavy_augment

import static qupath.lib.gui.scripting.QPEx.*
import qupath.lib.objects.PathCellObject
import qupath.lib.objects.PathDetectionObject
import qupath.tensorflow.stardist.StarDist2D

//  User enter these information for every project.
// Specify the model directory (you will need to change this!)
def pathModel = '/Volumes/Seagate_Backup_Plus_Drive/PostDoc/QuPath/he_heavy_augment'  
def PixelWidth_new = 1.000;
def PixelHeight_new = 1.000;
def x_left = 100;
def y_left = 100;
def w_ROI =  150;
def h_ROI = 150;

def project = getProject()
def entry = getProjectEntry()
def imageData = entry.readImageData()
def CurrentImageData = getCurrentImageData()
def hierarchy = imageData.getHierarchy()
def annotations = hierarchy.getAnnotationObjects()

if(pixelWidth == Double.NaN){
    setPixelSizeMicrons(PixelWidth_new, PixelHeight_new);

setColorDeconvolutionStains('{"Name" : "H&E default", "Stain 1" : "Hematoxylin", "Values 1" : "0.65111 0.70119 0.29049 ", "Stain 2" : "Eosin", "Values 2" : "0.2159 0.8012 0.5581 ", "Background" : " 255 255 255 "}');

def stardist = StarDist2D.builder(pathModel)
      .threshold(0.5)              // Prediction threshold
      .normalizePercentiles(1, 99) // Percentile normalization
      .pixelSize(0.5)              // Resolution for detection
println "Success";
// Run detection for the selected objects
//def imageData = getCurrentImageData()
def pathObjects = getSelectedObjects()
if (pathObjects.isEmpty()) {
    Dialogs.showErrorMessage("StarDist", "Please select a parent object!")
stardist.detectObjects(CurrentImageData, pathObjects)   // crashes here and qupath quits
  • Mac OS X El Capitan version 10.11.6

  • Processor Intel Core i5

  • RAM is 8GB

Here is the error I got after the QuPath quits

Process:               QuPath-0.2.3 [7647]
Path:                  /Users/USER/Documents/*/
Identifier:            QuPath
Version:               0.2.3 (100)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           QuPath-0.2.3 [7647]

Date/Time:             2020-12-04 13:23:51.829 +0300
OS Version:            Mac OS X 10.11.6 (15G22010)

Anonymous UUID:        A741C1D7-31B9-B7C7-2526-9F1D30076A59

Sleep/Wake UUID:       102B9241-D308-4291-B222-BFC7BF233024

Time Awake Since Boot: 55000 seconds
Time Since Wake:       2400 seconds

System Integrity Protection: enabled

Crashed Thread:        51  Java: richscripteditor-1

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000002, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:

Dyld Error Message:
  Symbol not found: _clock_gettime
  Referenced from: /Users/USER/*/ (which was built for Mac OS X 10.13)
  Expected in: /usr/lib/libSystem.B.dylib

Thanks, it looks like the issue is that TensorFlow isn’t working on OS X 10.11.6.

From the error report, it seems it requires a _clock_gettime method that wasn’t available until 10.12.

Here is a related StackOverflow discussion:


Thanks @petebankhead ,this was helpful to solve the issue