Cython compilation error: dynamic module does not detect module export function

I am creating a package in Keaton. I use the following setup.py structure:

 from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize import numpy import scipy extensions = [ Extension("xxxxx",["xxxx/xxxxx.pyx"], include_dirs=[numpy.get_include(),"."]), Extension("nnls",["xxxxx/xxxxx.pyx"], include_dirs=[numpy.get_include(),"."]), ] setup( name='xxxxxx', version='0.0.0', description='''********''', url='xxxxxxx', author='xxxxx', author_email='xxxxx', packages=[ 'xxxxx', ], install_requires=[ 'cython', 'numpy', 'scipy', ], ext_modules=cythonize(extensions), ) 

However, I get an error message when installing in Python 3. It works in Python 2, however it does not compile in Python 3 with the following error:

dynamic module does not define module export function

How can I solve this problem? Is the setup.py structure the reason why this is not compiling?

+8
python numpy cython
source share
1 answer

You need to call setup.py with Python 3 ( python3 setup.py build_ext , possibly --inplace ). This is because Python 3 defines a different name for the init function that is called when the module starts, and therefore you need to create it using Python 3 to provide the correct name.

See Cython compilation error: the dynamic module does not define the export function of the module and How to specify the source of Python 3 in the configuration of Cython.py? a little more detail (it borders on a duplicate of these questions, but not quite in my opinion)

+4
source share

All Articles