0

I have a problem with importing numpy. i did the reinstalling and also used the "pip3 install numpy" command but when i try to import it i face this problem:

>>> import numpy
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import numpy
  File "C:\Users\Ehsan_D\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py", line 305, in <module>
    _win_os_check()
  File "C:\Users\Ehsan_D\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py", line 302, in _win_os_check
    raise RuntimeError(msg.format(__file__)) from None
RuntimeError: The current Numpy installation ('C:\\Users\\Ehsan_D\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. 

how can i fix it

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Ehsan d
  • 1
  • 1
  • 2
    Maybe this previous [Thread](https://stackoverflow.com/questions/64654805/how-do-you-fix-runtimeerror-package-fails-to-pass-a-sanity-check-for-numpy-an) may be helpful as your issues seems the same. – Ed Bryce Nov 21 '20 at 17:55
  • 4
    Does this answer your question? [How do you fix "runtimeError: package fails to pass a sanity check" for numpy and pandas?](https://stackoverflow.com/questions/64654805/how-do-you-fix-runtimeerror-package-fails-to-pass-a-sanity-check-for-numpy-an) – Michael Szczesny Nov 21 '20 at 18:13

1 Answers1

0

There seems to be a problem with version 1.19.4. Just open a command prompt and run

pip install numpy==1.19.3
Kostas Letros
  • 53
  • 1
  • 11
  • More details here: https://stackoverflow.com/questions/64654805/how-do-you-fix-runtimeerror-package-fails-to-pass-a-sanity-check-for-numpy-an – Rivers Nov 21 '20 at 17:57
  • But now i have another problem, i cant import "pandas", this is the error i get : import pandas Traceback (most recent call last): File "", line 1, in import pandas ModuleNotFoundError: No module named 'pandas' – Ehsan d Nov 22 '20 at 08:22
  • try `pip install pandas` or if you have multiple versions of python installed, try ` -m pip install pandas`. For example: `C:\Users\eyllanesc\AppData\Local\Programs\Python\Python39\python.exe -m pip install pandas` – Kostas Letros Nov 23 '20 at 09:31