ImportError: No module named Cython.Distutils

Hi guys,

Just tried to install the beta pyhthon version of CellProfiler, and ran into an error. I’m installing by the way on a 64bit windows 7 machine. I followed the instructions from to the letter, started with “python” and after some compile messages I got the following error:

Traceback (most recent call last):
  File "", line 3, in <module>
    from Cython.Distutils import build_ext
ImportError: No module named Cython.Distutils

Rerunning “python” now skips the compile messages and jumps directly to the error message. I’ve made a full screendump of all messages here: I’m not sure what’s wrong, any clues?

As always, thanks for the help,
Berend Snijder

Hi Berend,

You can obtain the Cython installer for Python 2.5 from here: If that doesn’t work for you, you can grab the TAR or ZIP file, extract the contents to a local directory, cd to that directory from the command line, and type python install
Then create a cfg file for distutils (distutils.cfg) in your Python installation directory under the /Lib/distutils/ folder which contains the following:


Then give it another try. If this works for you, let us know and I’ll make sure to note it on the webpage (or find out if something else went wrong).


Hi Mark,

Thanks for your answer! That worked, but unfortunately shifted the problem on to the next package, numpy.

D:\pyCellProfiler\CellProfiler\pyCellProfiler>python Traceback (most recent call last): File "", line 4, in <module> from numpy import get_include ImportError: No module named numpy

So -extrapolating from your previous tip- I downloaded an installer for numpy for python 2.5, installed numpy, and tried starting up again. Running “python” got a bit further, up to where I get the following error relating to _ffmpeg and python stops working

To make sure I didn’t make any silly mistakes I tried a clean copy of pyCellProfiler from svn, and repeated the procedure as indicated on your website. This ended up with the same error as you see in the screenshot, probably since numpy and cython were now already correctly installed.

Both cython and numpy are in the superpack for windows, so this seems to be not working correctly. Perhaps I can tell you what I did, so you can check my steps. Let’s say I create a directory in D: called “pyCellProfiler”, and do the svn copy in there from your repository, then the “site-packages” directory where in the end I have to unpack the contents of the superpack to is: “D:\pyCellProfiler\CellProfiler\pyCellProfiler\site-packages”, is this correct?


Hi Berend,

A couple of things:

  • First, the screen capture doesn’t show any error, just warnings, so it seems like the build was successful. Did you get a crash window following the ffmpeg build (something like a dialog box offering to send the crash results to Microsoft)? If so, could you give us a screen capture of window showing the failure details?

  • Our suspicion is that some of the problems are related to the fact that you’re using a 64-bit OS. You might do better not using the superpack at all and installing the packages individually. So you can remove the site-packages directory, and download/install the following for Python 2.5.
    (following the instructions I gave before)


  • WxPython

  • NumPy

  • SciPy

  • MatplotLib

  • PIL

Most of these have .exe installers for Windows, you may need to look a bit.

Lastly, if you still encounter the same inexplicable crash, it may be a similar problem I’ve encountered. Try opening and placing the following line right before the import sys line (around line 16):

Let us know if this works!

Hi Mark,

Great, your last suggestion fixed the problem!

I had a look at the crash reports Windows wanted to send to Microsoft, it reported 3 problematic programs: “python.exe” (that stopped working), “_propagate.pyd”, and “kernel32.dll”.

Without trying to reinstall all packages, I guessed the “_propagate.pyd” file might be related to your “import cellprofiler.cpmath.propagate” suggestion. So I took a shot and followed that one first. Now pyCellProfiler runs like a charm! :smiley:

If you think it might help I’d be happy to e-mail you the full crash-report files.

Thanks for your help! (& keep up the good work :smile: ),

That’s good to hear! Once we get a fix for the _propagate issue, we’ll let you know.