Search code examples
pythonpython-3.xcython

NameError: name 'setup' is not defined


Trying to build a simple app integrate with cython.

Anyway I keep getting: When I enter in CMD:

python setup.py build_ext --inplace

Traceback (most recent call last):
  File "setup.py", line 3, in <module>
    setup(
NameError: name 'setup' is not defined

File:

    from setuptools import Extension 
    from setuptools import Extension
    Setup(
        name='main.py',
        entry_points={
            'console_scripts': [Executable('myapp = myapp.main:main')]
        },
        ext_modules=[
            Extension('myapp.cython_module', ['myapp/cython_module.pyx'])
        ],

)

I swear this was working yesterday. As far as I can tell it is named/declared


Solution

  • Looks like it's just some confusion about where all the names are coming from, and exactly how they're spelled/capitalized. I'm writing based on the examples on this page

    from setuptools import Extension
    from subzero import Executable, setup
    
    setup(name='main.py', ...)