Cython + setuptools not working with .pyx,only with .c-files

Stefan Behnel stefan_ml at
Fri Aug 7 18:31:27 CEST 2009

Diez B. Roggisch wrote:
> I'm trying to build a Cython-extension as Egg.
> However, this doesn't work - I can either use distutils to build the
> extension, creating a myextension.c-file on the way.
> If that's there, I can use setuptools to build the egg.
> But when I remove the .c-file, the .pyx-file isn't used to re-generate it.

setuptools monkeypatch into distutils to support Pyrex if it's installed,
but most non-bleeding-edge versions do not know about Cython and thus break
the Cython distutils support when Pyrex isn't there as well.

What helps is to put a fake Pyrex installation into your sys.path, like

as done at the top of

I haven't tried if newer setuptools versions have been fixed yet.


More information about the Python-list mailing list