8000 FMod Bug on Windows · numpy/numpy Wiki · GitHub
[go: up one dir, main page]

Skip to content

FMod Bug on Windows

Mingye Wang edited this page May 12, 2021 · 13 revisions

There is a crashing bug with fmod on windows, see https://developercommunity.visualstudio.com/t/fmod-after-an-update-to-windows-2004-is-causing-a/1207405

To prevent unexpected runtime behavior, opencv contains a Check for this:

from numpy import arange, linalg, float64
try:
    a = arange(13 * 13, dtype=float64).reshape(13, 13)
    a = a % 17  # calls fmod
    linalg.eig(a)
except Exception:
    raise RuntimeError("The current Numpy installation (...) fails to pass a sanity check due to a bug in the windows runtime...")

See Pull Request https://github.com/numpy/numpy/pull/17553

Workaround

This is a windows issue and has to be fixed by Microsoft. KB4598291 of February 2, 2021 fixes this issue (you can check it yourself using the script above).

  • Pinning against NumPy 1.19.3 should help (it uses a newer OpenBLAS version, but this caused other problems). This can be achieved using e.g. with pip install numpy==1.19.3 or similar depending on your setup. To be clear: The only difference between NumPy 1.19.3 and 1.19.4 is the OpenBLAS version it ships.
  • 32bit Python does not have these issues
  • In principle you could revert the buggy windows update or deactivate the _win_os_check in NumPy (if you are lucky, your code is unaffected by the bug).
Clone this wiki locally
0