Hello.

On 9/27/19 5:37 AM, Orion Poplawski wrote:
I could use some help with some cython issues building pandas for EL8. First attempt:

https://koji.fedoraproject.org/koji/taskinfo?taskID=37887295

running build_ext
pandas._libs.algos: -> [['pandas/_libs/algos.c']]
Traceback (most recent call last):
  File "setup.py", line 838, in <module>
    **setuptools_kwargs
  File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "setup.py", line 407, in build_extensions
    self.check_cython_extensions(self.extensions)
  File "setup.py", line 402, in check_cython_extensions
    src=src
Exception: Cython-generated file 'pandas/_libs/algos.c' not found.
                Cython is required to compile pandas from a development branch.
                Please install Cython or download a release package of pandas.

Compared to a rawhide build, it seems like the cython c files are not being automatically regenerated at the start of the build.  What component is supposed to handle this?
This is handled by setuptools directly. It seems that there is some Cython version restriction: https://github.com/pandas-dev/pandas/blob/master/setup.py#L48

Second attempt to run cython by hand generates another error:

https://koji.fedoraproject.org/koji/taskinfo?taskID=37887587

+ cython ./pandas/_libs/missing.pyx ./pandas/_libs/testing.pyx ./pandas/_libs/interval.pyx ./pandas/_libs/window.pyx ./pandas/_libs/internals.pyx ./pandas/_libs/join.pyx ./pandas/_libs/index.pyx ./pandas/_libs/writers.pyx ./pandas/_libs/groupby.pyx ./pandas/_libs/reduction.pyx ./pandas/_libs/hashtable.pyx ./pandas/_libs/parsers.pyx ./pandas/_libs/tslibs/conversion.pyx ./pandas/_libs/tslibs/np_datetime.pyx ./pandas/_libs/tslibs/period.pyx ./pandas/_libs/tslibs/timedeltas.pyx ./pandas/_libs/tslibs/ccalendar.pyx ./pandas/_libs/tslibs/strptime.pyx ./pandas/_libs/tslibs/resolution.pyx ./pandas/_libs/tslibs/fields.pyx ./pandas/_libs/tslibs/c_timestamp.pyx ./pandas/_libs/tslibs/offsets.pyx ./pandas/_libs/tslibs/timestamps.pyx ./pandas/_libs/tslibs/parsing.pyx ./pandas/_libs/tslibs/tzconversion.pyx ./pandas/_libs/tslibs/timezones.pyx ./pandas/_libs/tslibs/frequencies.pyx ./pandas/_libs/tslibs/nattype.pyx ./pandas/_libs/hashing.pyx ./pandas/_libs/tslib.pyx ./pandas/_libs/indexing.pyx ./pandas/_libs/sparse.pyx ./pandas/_libs/algos.pyx ./pandas/_libs/skiplist.pyx ./pandas/_libs/ops.pyx ./pandas/_libs/reshape.pyx ./pandas/_libs/lib.pyx ./pandas/_libs/properties.pyx ./pandas/io/sas/sas.pyx ./pandas/io/msgpack/_packer.pyx ./pandas/io/msgpack/_unpacker.pyx
Error compiling Cython file:
------------------------------------------------------------
...
        cdef int status
        with nogil:
            status = tokenize_nrows(self.parser, nrows)
        if self.parser.warn_msg != NULL:
            print(self.parser.warn_msg, file=sys.stderr)
                                           ^
------------------------------------------------------------
pandas/_libs/parsers.pyx:932:44: Expected ')', found '='

It this because cython is too old in EL8?

This might be caused by the fact that Cython treats prints as Python 2 statement instead of Python 3 function by default. This can be solved by either import print_function from __future__ or add a comment "#cython: language_level=3" or without touching the source files using cython -3 command.

Lumír


TIA,

  Orion


_______________________________________________
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org