Cython: ImportError: No module named 'myModule': how to call a cython module containing a cimport to another cython nodule?

I encounter this problem again in an another project. To solve it, here is what I did:

  • all import and cimport statement must be fully qualified
  • all the python code must be contained in a rootFolder
  • the setup.py must be at the same level than the rootFolder
  • all folder in the rooFolder including the rootFolder must contains a __init__.py
  • in your setup.py the extension's include_dirs must contains '.'

I created a simple project which illustrates this here.
This page helped me created it.
But my project is simpler and I think it would have helped me a lot if I had it.
My project also illustrate how to automatically build all cython files in a project.


I might be missing something about Cython, but I think it's:

import package.user
user.doSomething()

Tags:

Python

Cython