0

I have installed the required modules, matplotlib, numpy, and pillow, but when I try to use pylab in Python 3.8.0 a long error message is displayed. Similar issues arise when trying to use other related modules such as numpy or matplotlib.

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pylab
  File "C:\Users\candl\AppData\Local\Programs\Python\Python38\lib\site-packages\pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "C:\Users\candl\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\__init__.py", line 107, in <module>
    from . import cbook, rcsetup
  File "C:\Users\candl\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\cbook\__init__.py", line 28, in <module>
    import numpy as np
  File "C:\Users\candl\AppData\Local\Programs\Python\Python38\lib\site-packages\numpy\__init__.py", line 305, in <module>
    _win_os_check()
  File "C:\Users\candl\AppData\Local\Programs\Python\Python38\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\\candl\\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: 

Does anyone have suggestions regarding these issues?

Andrew
  • 281
  • 3
  • 15
  • 1
    You copied the text *"See this issue for more information: "*, but seem to have left off the rest of the sentence. – JohanC Dec 23 '20 at 15:19
  • Did you look into [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)? – JohanC Dec 23 '20 at 15:21
  • Thank you, I read that post and installing numpy 1.19.3 fixed the issue – Andrew Dec 23 '20 at 15:25
  • 1
    FYI: You should probably [not use pylab](https://matplotlib.org/api/index.html#module-pylab) anymore. – MaxPowers Dec 23 '20 at 15:28

1 Answers1

1

Try this:

pip uninstall numpy 

and then:

pip install numpy==1.19.3

A google search showed me that this error occurs when using python3.9 and numpy1.19.4 So uninstalling numpy1.19.4 and installing 1.19.3 will work.

I know that your python version is older than 3.9 but this should still work.

For more reference:

https://github.com/int-brain-lab/iblenv/issues/111

How do you fix "runtimeError: package fails to pass a sanity check" for numpy and pandas?

psychoSherlock
  • 112
  • 1
  • 9