Batch commands error

Dear all,

I’ve been trying to use CellProfiler (2.1.1) in batch mode and I’ve encountered a problem when running following commands specified by --get-batch-commands option. For a trivial example (3 images, no grouping, just IdentifyPrimaryObjects module) I get commands:

CellProfiler -c -r -b -p /home/krab1k/Batch_data.h5 -g ImageNumber=1
CellProfiler -c -r -b -p /home/krab1k/Batch_data.h5 -g ImageNumber=2
CellProfiler -c -r -b -p /home/krab1k/Batch_data.h5 -g ImageNumber=3

However, any of these gives me the error:

Uncaught exception in
Traceback (most recent call last):
  File "", line 249, in main
    run_pipeline_headless(options, args)
  File "", line 826, in run_pipeline_headless
    initial_measurements = initial_measurements)
  File "/home/krab1k/Tmp/CellProfiler-2.1.1/cellprofiler/", line 1630, in run
    initial_measurements = measurements):
  File "/home/krab1k/Tmp/CellProfiler-2.1.1/cellprofiler/", line 1740, in run_with_yield
    in group(workspace):
  File "/home/krab1k/Tmp/CellProfiler-2.1.1/cellprofiler/", line 1658, in group
    ", ".join(grouping.keys()), ", ".join(keys)))
ValueError: The grouping keys specified on the command line (ImageNumber) must be the same as those defined by the modules in the pipeline ()

Am I doing something wrong, or it’s really a bug? :wink:

Thank you for help!

Hello Tomáš,

Not sure what the issue is, but you might best try the -f and -l switches instead of the -g switch (which is meant for groups and you apparently have none).
Some more info here on these switches: … nvironment

It’s also possible that there was a bug that was fixed, e.g.: … ssues/1254
So if you are still having trouble, try a newer trunk build:

Hope that helps,

Hello David,

thanks for the suggestions. However, I came across several difficulties when trying to use trunk version. I’ve noticed that javabridge is now a separate project, unfortunately I am not able to install it. If I use pip or easy_install I end up with:
If I try to use version from git and run “python2 build” I get the following instead:

Do you have any idea where the problem might be?

(I tried to apply the patch from the issue you mentioned on 2.1.1 release, but that seemed to have no effect on the aforementioned problem.)

My main goal is write a script which takes Batch_data.h5 file and creates tasks which can be processed independently of each other for the jobs submission system (PBS in particular). That is no matter what pipeline user created (assuming it’s correct), to be able to generate CellProfiler commands from the batch file. I guess the number of “jobs/groups/images/whatever” should be enough (How do I get it?) if then I use -f and -l switches as you suggested. Am I right?

Thank you very much for your effort,

I notice that for the 1st error, it reports that the java_home variable is not set, whereas for the 2nd error, it is. Would you able to set it and try pip again?