Error message- fatal phython error PyEval_SaveThread: NULL t

Hi there,

I have been slowly learning to use CellProfiler. I have recently implemented ilastik learning modules to enhance my classification. It seems to be going well, until today. I keep trying to analyze a dataset and it shuts down 58/81 images into the analysis. I have used the pipeline on another smaller dataset without a problem so I am not sure what to make of the abrupt inability to run it, except that it might be time to upgrade from r11710 to v2- (more on that below). The Error message:

DataMgr initalizing module: Classification
Adding new overlay Classification/Labels
#Fatal phython error PyEval_SaveThread: NULL tstate

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more info. 
Exception in Feature Thread
Precondition violation!
convolveLine <>: kernel longer than line


At first I tried restarting my computer but that did not help! Feeling a bit stuck, I tried to upgrade. But the new software does not open. The command prompt window opens, flashes some writing including WARNING, but I can’t read the rest before it shuts down. I am not feeling particularly tech savvy at the moment and would be grateful for your suggestions. I have made great progress on my image analysis using CellProfilier (on my Window 7-64 bit) and I would like to finish it!! I couldn’t find any other threads for trouble installing CellProfilier v2 or this error message.

Many thanks,

I tried to upgrade Java and reanalyze. It made it to 58/81 images with a different message.

DataMgr initalizing module: Classification
Adding new overlay Classification/Labels
###############exception in FeatureThread##########Fatal phython error: ceval: tstate mix-up

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more info. 

Any suggestions would be appreciated. Thanks!

Hi Melissa,
Could you try uninstalling CellProfiler, removing the directory (by default, at c:\Program Files\CellProfiler) and installing the 64-bit Windows version? After that, you can open up a command prompt (hit the start button and type “cmd” into the box at the bottom marked “search programs and files” and then type:

(you have to type the double-quotes as well).

It should print the error message into the command window and that should help.

Regarding the failure after 53 image cycles, CP 2.1 may help a bit by breaking the analysis into several pieces and executing them in separate CP instances. For lengthy analyses, you might have better luck breaking the analysis into smaller chunks, either by using CreateBatchFiles or by just running CellProfiler on subsets of the data. It does look like Ilastik is running into problems on one particular image set (# 58) - you might try eliminating that one and it might be helpful if you sent us the images from that image set and pipeline so we can reproduce the problem.

Thanks for getting back to me. I broke up the large batch into small runs to get it done. Now I will tackle the upgrade. Here is the message. I am not sure what to do to fix it. I appreciate your advice. Thanks!

Microsoft Windows [Version 6.1.7601]
Copyright © 2009 Microsoft Corporation. All rights reserved.

J:\Users\Nikon>"J:\Program Files\CellProfiler\Cellprofiler"
Warning: current path of J:UsersNikonDesktopBRCA Image Processing Files VentanaB
C set2 50 to 73MAPK large set071114 MAPK new image v1 ilastiktest is not a valid
directory. Switching to home directory.
Failed to load CreateBatchFiles
Traceback (most recent call last):
File “cellprofiler\modules_init_.pyc”, line 333, in add_module
File “cellprofiler\cpmodule.pyc”, line 91, in init
File “cellprofiler\modules\createbatchfiles.pyc”, line 92, in create_settings
File “cellprofiler\preferences.pyc”, line 459, in get_default_output_directory

File “cellprofiler\preferences.pyc”, line 464, in set_default_output_directory

AssertionError: Default Output Folder, “J:\Users\Nikon\SET HOME=“J:\Program File
s\R\R-2.13.2\library””, is not a directory
could not load these modules: cellprofiler.modules.createbatchfiles
Warning: current path of J:\Program Files\CellProfiler\SET HOME=“J:\Program File
s\R\R-2.13.2\library” is not a valid directory. Switching to home directory.
Uncaught exception in
Traceback (most recent call last):
File “”, line 168, in main
File “cellprofiler\cellprofilerapp.pyc”, line 37, in init
File “wx_core.pyc”, line 7978, in init
File “wx_core.pyc”, line 7552, in _BootstrapApp
File “cellprofiler\cellprofilerapp.pyc”, line 68, in OnInit
File “cellprofiler\gui\cpframe.pyc”, line 311, in init
File “cellprofiler\gui\cpframe.pyc”, line 1199, in __attach_views
File “cellprofiler\gui\preferencesview.pyc”, line 55, in init
File “cellprofiler\preferences.pyc”, line 404, in get_default_image_directory
File “cellprofiler\preferences.pyc”, line 412, in set_default_image_directory
File “cellprofiler\preferences.pyc”, line 418, in fire_image_directory_changed
File “cellprofiler\gui\pipelinecontroller.pyc”, line 1227, in __on_image_direc
File “cellprofiler\gui\pipelinecontroller.pyc”, line 1223, in on_image_set_mod
File “cellprofiler\workspace.pyc”, line 525, in invalidate_image_set
AttributeError: ‘NoneType’ object has no attribute 'clear’
stopping worker thread 0
stopping worker thread 1
stopping worker thread 2
stopping worker thread 3
stopping worker thread 4
Exiting the JVM monitor thread


Hi Melissa,

There are a couple warnings here that indicate you should check all your “default” paths/folders.
(1) In CP, click the View Output Settings button at the bottom of your pipeline. Ensure that the output (and input if there) directories are valid.
(2) Also check the paths in your File -> Preferences. There are likely Default Input and Output directories at the top, but also some plugin directories mid-way down. Also ensure that these are set to valid paths. Click OK and then restart CP.

Hope that helps,

Right now, it exits the module before loading it. I can not access any Preferences or File paths. In the old version, it would open and I could always alter the paths. But the new version will not load properly. Is there another way to do it? From the command line?


I see, I didn’t realize it was still erroring on startup. First, exit CellProfiler. I would next try clearing the registry entry for CellProfiler. To find it, follow the directions here, but once you find the entry, right-click and delete it. Then hopefully CellProfiler will open up as brand new!


It worked! It finally opened the new version! Thank you for your help. Have a great weekend!