Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cythonize GIL error #9

Open
RomainBrault opened this issue Nov 27, 2017 · 6 comments
Open

Cythonize GIL error #9

RomainBrault opened this issue Nov 27, 2017 · 6 comments
Assignees
Labels

Comments

@RomainBrault
Copy link
Collaborator

Error compiling Cython file:

...

cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2,
                         ITYPE_t size) except -1 with gil:
    cdef np.ndarray x1arr
    cdef np.ndarray x2arr
    with gil:
        ^

sklearn/neighbors/dist_metrics.pyx:1111:13: Trying to acquire the GIL while it is already held.
Traceback (most recent call last):
File "/home/rbrault/OCRF/build_tools/cythonize.py", line 198, in
main(root_dir_arg)
File "/home/rbrault/OCRF/build_tools/cythonize.py", line 190, in main
check_and_cythonize(root_dir)
File "/home/rbrault/OCRF/build_tools/cythonize.py", line 182, in check_and_cythonize
cythonize_if_unchanged(cur_dir, cython_file, gen_file, hashes)
File "/home/rbrault/OCRF/build_tools/cythonize.py", line 156, in cythonize_if_unchanged
cythonize(full_cython_path, full_gen_file_path)
File "/home/rbrault/OCRF/build_tools/cythonize.py", line 75, in cythonize
raise Exception('Cythonizing %s failed' % cython_file)
Exception: Cythonizing sklearn/neighbors/dist_metrics.pyx failed
Traceback (most recent call last):
File "setup.py", line 315, in
setup_package()
File "setup.py", line 299, in setup_package
generate_cython()
File "setup.py", line 185, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!

Need investigation.

Linux-4.10.0-40-generic-x86_64-with-debian-stretch-sid
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 16 2017, 15:28:36)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]
NumPy 1.13.3
SciPy 0.19.1
GCC 7.0.1

Related issue:
https://stackoverflow.com/questions/46920490/sklearn-installation-trying-to-acquire-the-gil-while-it-is-already-held

@RomainBrault RomainBrault self-assigned this Nov 27, 2017
@minoriinoue
Copy link

I got the same issue. Thanks for investigating the error.

@RomainBrault
Copy link
Collaborator Author

Related issues:
scikit-learn/scikit-learn#9272

Possible fix:
scikit-learn/scikit-learn#9311

@minoriinoue
Copy link

Could fix the issue with the possible fix you mentioned(scikit-learn/scikit-learn#9311). Thanks a lot.

@RomainBrault
Copy link
Collaborator Author

@minoriinoue, thanks for the feedback.

@vinhqdang
Copy link

Could you elaborate more on how to fix the bug? It is not clear for me :-(

@RomainBrault
Copy link
Collaborator Author

@vinhqdang you can have a look to

scikit-learn/scikit-learn@95f1bb0

for the exact fix. Just copy-paste the changes to the file sklearn/neighbors/dist_metrics.pyx. I'll try to do a PR later for this bug.

@ngoix we could just fetch master again, see if can still run the benchs? That would avoid incompatibilities due to newer version of cython.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants