[Python] Python Numpy Crash without error or warning with exit code -1073740791 due to...

Discussão em 'Python' iniciado por Stack, Fevereiro 10, 2025.

  1. Stack

    Stack Membro Participativo

    Numpy library crash without console error or warning constantly

    In Python Console see notifications either Process finished with exit code -1073741819 (0xC0000005) or Process finished with exit code -1073740791 (0xC0000409)

    Tried to solve issue by using python [Python 3.13.2] [Python 3.12.9] [Python 3.12.5]
    I also tried multiple versions of NumPy: [1.26.4], [2.2.2], [2.1.1]

    I cannot point out exact line of code where it crashes as it vary from time to time. Sometimes it is on np.where, other time in np.maximum.accumulate and so on.

    On simple calculations it works fine (i.e. when I apply NumPy to lines less then 100k), but apply to a bigger data it fails. Usually after 4 min of calculations.

    https://github.com/numpy/numpy/issues/28308

    Here is the error message:

    Faulting Application Name: python.exe, Version: 3.12.9150.1013, Timestamp: 0x67a232aa
    Faulting Module Name: _multiarray_umath.cp312-win_amd64.pyd, Version: 0.0.0.0, Timestamp: 0x00000000
    Exception Code: 0xc0000005
    Fault Offset: 0x000000000007c502
    Faulting Process ID: 0x7324
    Faulting Application Start Time: 0x1DB7ACE52598435
    Faulting Application Path: C:\Users\Tony\AppData\Local\Programs\Python\Python312\python.exe
    Faulting Module Path: C:\Users\Tony\AppData\Local\Programs\Python\Python313\TradingData\Lib\site-packages\numpy\core_multiarray_umath.cp312-win_amd64.pyd
    Report Identifier: 833671e4-3a45-466e-b46c-693883b70457
    Faulting Package Full Name:
    Faulting Package App ID:


    My PC info:
    CPU: CPU Type 8C+16c Intel Core i9-13900KF, 5500 MHz (55 x 100)
    Mother: Motherboard Name Asus ROG Strix Z790-A Gaming WiFi II (1 PCI-E x1, 2 PCI-E x16, 4 M.2, 4 DDR5 DIMM, Audio, Video, 2.5GbE LAN, WiFi)
    RAM: 128gb 4xG Skill F5-6800J3445G32G 32 GB DDR5-4800 DDR5 SDRAM (42-41-41-77 @ 2403 MHz) (40-40-40-77 @ 2400 MHz) (36-36-36-70 @ 2160 MHz) (32-32-32-62 @ 1920 MHz) (30-30-30-58 @ 1800 MHz) (28-28-28-54 @ 1680 MHz) (22-22-22-43 @ 1320 MHz)

    Reproducing code example:

    import numpy as np
    from numpy.lib.stride_tricks import sliding_window_view

    for i in range(0,60):

    w = 60
    x = np.random.rand(9000000)
    window = sliding_window_view(x, window_shape=w)


    def cor_max(row):
    try:
    n = np.where(row >= np.quantile(row, 0.9))[0]
    if len(n) == 0:
    return np.nan
    else:
    r = np.corrcoef(n, range(len(n)))[0][1]
    return r
    except:
    return np.nan


    x1 = np.apply_along_axis(cor_max, axis=1, arr=window)
    x1 = np.append(np.empty(w - 1), x1)


    def cor_min(row):
    try:
    n = np.where(row <= np.quantile(row, 0.1))[0]
    if len(n) == 0:
    return np.nan
    else:
    r = np.corrcoef(n, range(len(n)))[0][1]
    return r
    except:
    return np.nan


    x1 = np.apply_along_axis(cor_min, axis=1, arr=window)
    x1 = np.append(np.empty(w - 1), x1)


    def n_max_change(row):
    try:
    cummax = np.maximum.accumulate(row)
    updates = np.diff(cummax) > 0
    n_updates = np.sum(updates)

    return n_updates / len(row)
    except:
    return np.nan


    x1 = np.apply_along_axis(n_max_change, axis=1, arr=window)
    x1 = np.append(np.empty(w - 1), x1)
    print(i)


    I expect help on a ways to solve the issue

    Continue reading...

Compartilhe esta Página