Skip to content

NameError: name 'tempita' is not defined when building extensions with old cython #28836

Closed
@toobaz

Description

@toobaz

Code Sample, a copy-pastable example if possible

pietro@debiousci:~/nobackup/repo/pandas_temp$ python3 setup.py build_ext --inplace 
Traceback (most recent call last):
  File "setup.py", line 813, in <module>
    ext_modules=maybe_cythonize(extensions, compiler_directives=directives),
  File "setup.py", line 541, in maybe_cythonize
    build_ext.render_templates(_pxifiles)
  File "setup.py", line 127, in render_templates
    pyxcontent = tempita.sub(tmpl)
NameError: name 'tempita' is not defined

Problem description

If cython is too old/missing, the nice error reporting of the setup.py do not work.

Until few minutes ago I had never heard about tempita, but my understanding is that it is required (used in build_ext.render_templates) while cython is not:

cython = False

Hence, whether the check for tempita is made should not depend on whether cython is found: instead, this is what currently happens, given that tempita is checked in the else clause of the try...except check of cython:

try:

Notice that this means the above error pops out despite tempita being installed in my system.

Expected Output

None

Output of pd.show_versions()

Commit: bee17d5

Metadata

Metadata

Assignees

No one assigned

    Labels

    BuildLibrary building on various platforms

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions