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

BUG: scipy.Spatial.KDTree Process finished with exit code -1073741571 (0xC00000FD) #14799

Open
samFarrellDay opened this issue Oct 3, 2021 · 2 comments
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected

Comments

@samFarrellDay
Copy link

samFarrellDay commented Oct 3, 2021

Describe your issue.

KDTree hits this error when it encounters too many duplicates. Without rounding, the reproduceable example works fine. I am running on Windows 10, 16GB memory, Python version 3.9.6.

Reproducing Code Example

from scipy.spatial import KDTree
import numpy as np
random_state = np.random.RandomState(1)
candidate_preds = random_state.uniform(-10,7,size=(294392,1))
candidate_preds = 1/(1+np.exp(-candidate_preds))
candidate_preds = candidate_preds.round(4)
kd_tree = KDTree(candidate_preds, leafsize=100)

Error message

Process finished with exit code -1073741571 (0xC00000FD)

SciPy/NumPy/Python version information

1.7.0 1.21.1 sys.version_info(major=3, minor=9, micro=6, releaselevel='final', serial=0)

@samFarrellDay samFarrellDay added the defect A clear bug or issue that prevents SciPy from being installed or used as expected label Oct 3, 2021
@tupui
Copy link
Member

tupui commented Oct 3, 2021

Hi @samFarrellDay, thanks for the report. On macOS I cannot reproduce. I would say you could be hitting the recursion limit (0xC00000FD stands for "stack overflow").

Did you try with other parameters on the KDTree or could you try to change the recursion limit of Python (with import sys;sys.setrecursionlimit(1500), don't put something too high. Check the current value with print(sys.getrecursionlimit()))? Or you can play on the stack size, see here.

@samFarrellDay
Copy link
Author

samFarrellDay commented Oct 3, 2021

I did try different recursion limits to no avail. Changing leaf size also does not help. However, setting balanced_tree=False fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected
Projects
None yet
Development

No branches or pull requests

2 participants