Skip to content

Building from git fails: Error compiling Cython file: Pythonic division not allowed without gil #6719

Closed
@gerritholl

Description

@gerritholl

Building numpy from git fails when Cythonizing numpy/random/mtrand/mtrand.pyx, due to an error Pythonic division not allowed without gil, consider using cython.cdivision(True). This is Python 3.5.0, Cython 0.23.4, with numpy git revision d94043f0fb93985fd4302eae9fcdca2d79239908 on branch master. The same problem occurs on branch maintenance/1.10.x with commit 76db1ab4edef69e310426dccf95c15212b1ba4a6, and on branch maintenance/1.9.x with commit edb902cdc6573553afcf11047ecdfb447e444322. However, a regular pip install numpy (which installs 1.10.1), works (because releases include compiled cython files, but version control does not). The failures occur as follows:

$ python3.5 setup.py build_ext                                                                       
Running from numpy source directory.
Cythonizing sources
Processing numpy/random/mtrand/mtrand.pyx

Error compiling Cython file:
------------------------------------------------------------
...
            i = 0
            while i < sz:
                Sum = 1.0
                dn = n
                for j from 0 <= j < d-1:
                    mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum)
                                                                          ^
------------------------------------------------------------

mtrand.pyx:4484:75: Pythonic division not allowed without gil, consider using cython.cdivision(True)
Traceback (most recent call last):
  File "/tmp/numpy/tools/cythonize.py", line 199, in <module>
    main()
  File "/tmp/numpy/tools/cythonize.py", line 195, in main
    find_process_files(root_dir)
  File "/tmp/numpy/tools/cythonize.py", line 187, in find_process_files
    process(cur_dir, fromfile, tofile, function, hash_db)
  File "/tmp/numpy/tools/cythonize.py", line 161, in process
    processor_function(fromfile, tofile)
  File "/tmp/numpy/tools/cythonize.py", line 72, in process_pyx
    raise Exception('Cython failed')
Exception: Cython failed
Traceback (most recent call last):
  File "setup.py", line 263, in <module>
    setup_package()
  File "setup.py", line 251, in setup_package
    generate_cython()
  File "setup.py", line 199, in generate_cython
    raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!

What's going wrong?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions