How do I resolve a sanity check error when importing "numpy" within MATLAB?
4 views (last 30 days)
Show older comments
MathWorks Support Team
on 8 Dec 2020
Answered: MathWorks Support Team
on 23 Feb 2021
Within MATLAB, I am trying to import "numpy". When I try to do so, I get the following error:
Error using __init__>_win_os_check (line 302)
Python Error: RuntimeError: The current Numpy installation
('C:\\Users\\<userName>\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due
to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86
Error in __init__><module> (line 305)
Error in getTime><module> (line 2)
Error in <frozen importlib>_call_with_frames_removed (line 219)
Error in <frozen importlib>exec_module (line 783)
Error in <frozen importlib>_load_unlocked (line 671)
Error in <frozen importlib>_find_and_load_unlocked (line 975)
Error in <frozen importlib>_find_and_load (line 991)
Error in <frozen importlib>_gcd_import (line 1014)
Error in __init__>import_module (line 127)
I am using Python 3.8 and MATLAB R2020b on a Windows 10 system, and I have "numpy" version 1.19.4. Why can't MATLAB find the "numpy" module which I have installed on my machine?
Accepted Answer
MathWorks Support Team
on 8 Dec 2020
This is a known bug in Windows Runtime in the way it attempts to load "numpy". As a workaround, you can install a different version of "numpy". Specifically, it is known that "numpy" version 1.19.3 works properly. You can install this version using the following command at the System Command Prompt:
pip install numpy==1.19.3
0 Comments
More Answers (0)
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!