title: RuntimeError: The current NumPy installation fails to pass a sanity check due to a bug in the windows runtime
body: <p>I am using Python 3.9 on Windows 10 version 2004 x64. PowerShell as Administrator.</p>
  <p>Python version:</p>
  <pre class="lang-none prettyprint-override"><code>Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
  </code></pre>
  <p>Install <code>matplotlib</code> error.</p>
  <pre class="lang-none prettyprint-override"><code>pip install virtualenv
  virtualenv foo
  cd .\foo
  .\Scripts\active
  pip install numpy
  pip install matplotlib
  </code></pre>
  <h3>Error</h3>
  <pre class="lang-none prettyprint-override"><code>Windows PowerShell
  Copyright (C) Microsoft Corporation. All rights reserved.
  
  Try the new cross-platform PowerShell https://aka.ms/pscore6
  
  PS C:\WINDOWS\system32&gt; Set-ExecutionPolicy Unrestricted -Force
  PS C:\WINDOWS\system32&gt; cd /d C:\Windows\System32\cmd.exe
  Set-Location : A positional parameter cannot be found that accepts argument 'C:\Windows\System32\cmd.exe'.
  At line:1 char:1
  + cd /d C:\Windows\System32\cmd.exe
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidArgument: (:) [Set-Location], ParameterBindingException
      + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
  
  PS C:\WINDOWS\system32&gt; cd C:\Windows\System32\cmd.exe
  cd : Cannot find path 'C:\Windows\System32\cmd.exe' because it does not exist.
  At line:1 char:1
  + cd C:\Windows\System32\cmd.exe
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (C:\Windows\System32\cmd.exe:String) [Set-Location], ItemNotFoundExcepti
     on
      + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
  
  PS C:\WINDOWS\system32&gt; cd D:\
  PS D:\&gt; cd .\Users\donhuvy\
  PS D:\Users\donhuvy&gt; ls
  
  
      Directory: D:\Users\donhuvy
  
  
  Mode                 LastWriteTime         Length Name
  ----                 -------------         ------ ----
  d-----        10/26/2020   3:35 PM                AppData
  d-----         11/7/2020   9:33 AM                PycharmProjects
  
  
  PS D:\Users\donhuvy&gt; cd .\PycharmProjects\pythonProject\
  PS D:\Users\donhuvy\PycharmProjects\pythonProject&gt; virtualenv foo
  virtualenv : The term 'virtualenv' is not recognized as the name of a cmdlet, function, script file, or operable
  program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  At line:1 char:1
  + virtualenv foo
  + ~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (virtualenv:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
  
  PS D:\Users\donhuvy\PycharmProjects\pythonProject&gt; pip install virtualenv
  Collecting virtualenv
    Downloading virtualenv-20.1.0-py2.py3-none-any.whl (4.9 MB)
       |████████████████████████████████| 4.9 MB 1.1 MB/s
  Collecting distlib&lt;1,&gt;=0.3.1
    Downloading distlib-0.3.1-py2.py3-none-any.whl (335 kB)
       |████████████████████████████████| 335 kB 6.4 MB/s
  Requirement already satisfied: six&lt;2,&gt;=1.9.0 in c:\users\donhuvy\appdata\roaming\python\python39\site-packages (from virtualenv) (1.15.0)
  Collecting filelock&lt;4,&gt;=3.0.0
    Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
  Collecting appdirs&lt;2,&gt;=1.4.3
    Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
  Installing collected packages: distlib, filelock, appdirs, virtualenv
  Successfully installed appdirs-1.4.4 distlib-0.3.1 filelock-3.0.12 virtualenv-20.1.0
  PS D:\Users\donhuvy\PycharmProjects\pythonProject&gt; virtualenv foo
  created virtual environment CPython3.9.0.final.0-64 in 1312ms
    creator CPython3Windows(dest=D:\Users\donhuvy\PycharmProjects\pythonProject\foo, clear=False, global=False)
    seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\donhuvy\AppData\Local\pypa\virtualenv)
      added seed packages: pip==20.2.4, setuptools==50.3.2, wheel==0.35.1
    activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
  PS D:\Users\donhuvy\PycharmProjects\pythonProject&gt; cd .\foo
  PS D:\Users\donhuvy\PycharmProjects\pythonProject\foo&gt; .\Scripts\activate
  (foo) PS D:\Users\donhuvy\PycharmProjects\pythonProject\foo&gt; pip install numpy
  Collecting numpy
    Using cached numpy-1.19.4-cp39-cp39-win_amd64.whl (13.0 MB)
  Installing collected packages: numpy
  Successfully installed numpy-1.19.4
  (foo) PS D:\Users\donhuvy\PycharmProjects\pythonProject\foo&gt; pip install matplotlib
  Collecting matplotlib
    Using cached matplotlib-3.3.2.tar.gz (37.9 MB)
   ** On entry to DGEBAL parameter number  3 had an illegal value
   ** On entry to DGEHRD  parameter number  2 had an illegal value
   ** On entry to DORGHR DORGQR parameter number  2 had an illegal value
   ** On entry to DHSEQR parameter number  4 had an illegal value
      ERROR: Command errored out with exit status 1:
       command: 'D:\Users\donhuvy\PycharmProjects\pythonProject\foo\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\donhuvy\\AppData\\Local\\Temp\\pip-install-8bn40qg7\\matplotlib\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\donhuvy\\AppData\\Local\\Temp\\pip-install-8bn40qg7\\matplotlib\\setup.py'&quot;'&quot;';f=getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__);code=f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' egg_info --egg-base 'C:\Users\donhuvy\AppData\Local\Temp\pip-pip-egg-info-39nmc0pe'
           cwd: C:\Users\donhuvy\AppData\Local\Temp\pip-install-8bn40qg7\matplotlib\
      Complete output (61 lines):
  
      Edit setup.cfg to change the build options; suppress output with --quiet.
  
      BUILDING MATPLOTLIB
        matplotlib: yes [3.3.2]
            python: yes [3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC
                        v.1927 64 bit (AMD64)]]
          platform: yes [win32]
       sample_data: yes [installing]
             tests: no  [skipping due to configuration]
            macosx: no  [Mac OS-X only]
  
      running egg_info
      creating C:\Users\donhuvy\AppData\Local\Temp\pip-pip-egg-info-39nmc0pe\matplotlib.egg-info
      writing C:\Users\donhuvy\AppData\Local\Temp\pip-pip-egg-info-39nmc0pe\matplotlib.egg-info\PKG-INFO
      writing dependency_links to C:\Users\donhuvy\AppData\Local\Temp\pip-pip-egg-info-39nmc0pe\matplotlib.egg-info\dependency_links.txt
      writing namespace_packages to C:\Users\donhuvy\AppData\Local\Temp\pip-pip-egg-info-39nmc0pe\matplotlib.egg-info\namespace_packages.txt
      writing requirements to C:\Users\donhuvy\AppData\Local\Temp\pip-pip-egg-info-39nmc0pe\matplotlib.egg-info\requires.txt
      writing top-level names to C:\Users\donhuvy\AppData\Local\Temp\pip-pip-egg-info-39nmc0pe\matplotlib.egg-info\top_level.txt
      writing manifest file 'C:\Users\donhuvy\AppData\Local\Temp\pip-pip-egg-info-39nmc0pe\matplotlib.egg-info\SOURCES.txt'
      Traceback (most recent call last):
        File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
        File &quot;C:\Users\donhuvy\AppData\Local\Temp\pip-install-8bn40qg7\matplotlib\setup.py&quot;, line 242, in &lt;module&gt;
          setup(  # Finally, pass this all along to distutils to do the heavy lifting.
        File &quot;D:\Users\donhuvy\PycharmProjects\pythonProject\foo\lib\site-packages\setuptools\__init__.py&quot;, line 153, in setup
          return distutils.core.setup(**attrs)
        File &quot;d:\users\donhuvy\appdata\local\programs\python\python39\lib\distutils\core.py&quot;, line 148, in setup
          dist.run_commands()
        File &quot;d:\users\donhuvy\appdata\local\programs\python\python39\lib\distutils\dist.py&quot;, line 966, in run_commands
          self.run_command(cmd)
        File &quot;d:\users\donhuvy\appdata\local\programs\python\python39\lib\distutils\dist.py&quot;, line 985, in run_command
          cmd_obj.run()
        File &quot;D:\Users\donhuvy\PycharmProjects\pythonProject\foo\lib\site-packages\setuptools\command\egg_info.py&quot;, line 298, in run
          self.find_sources()
        File &quot;D:\Users\donhuvy\PycharmProjects\pythonProject\foo\lib\site-packages\setuptools\command\egg_info.py&quot;, line 305, in find_sources
          mm.run()
        File &quot;D:\Users\donhuvy\PycharmProjects\pythonProject\foo\lib\site-packages\setuptools\command\egg_info.py&quot;, line 536, in run
          self.add_defaults()
        File &quot;D:\Users\donhuvy\PycharmProjects\pythonProject\foo\lib\site-packages\setuptools\command\egg_info.py&quot;, line 572, in add_defaults
          sdist.add_defaults(self)
        File &quot;d:\users\donhuvy\appdata\local\programs\python\python39\lib\distutils\command\sdist.py&quot;, line 228, in add_defaults
          self._add_defaults_ext()
        File &quot;d:\users\donhuvy\appdata\local\programs\python\python39\lib\distutils\command\sdist.py&quot;, line 311, in _add_defaults_ext
          build_ext = self.get_finalized_command('build_ext')
        File &quot;d:\users\donhuvy\appdata\local\programs\python\python39\lib\distutils\cmd.py&quot;, line 299, in get_finalized_command
          cmd_obj.ensure_finalized()
        File &quot;d:\users\donhuvy\appdata\local\programs\python\python39\lib\distutils\cmd.py&quot;, line 107, in ensure_finalized
          self.finalize_options()
        File &quot;C:\Users\donhuvy\AppData\Local\Temp\pip-install-8bn40qg7\matplotlib\setup.py&quot;, line 88, in finalize_options
          self.distribution.ext_modules[:] = [
        File &quot;C:\Users\donhuvy\AppData\Local\Temp\pip-install-8bn40qg7\matplotlib\setup.py&quot;, line 91, in &lt;listcomp&gt;
          for ext in package.get_extensions()
        File &quot;C:\Users\donhuvy\AppData\Local\Temp\pip-install-8bn40qg7\matplotlib\setupext.py&quot;, line 345, in get_extensions
          add_numpy_flags(ext)
        File &quot;C:\Users\donhuvy\AppData\Local\Temp\pip-install-8bn40qg7\matplotlib\setupext.py&quot;, line 469, in add_numpy_flags
          import numpy as np
        File &quot;D:\Users\donhuvy\PycharmProjects\pythonProject\foo\lib\site-packages\numpy\__init__.py&quot;, line 305, in &lt;module&gt;
          _win_os_check()
        File &quot;D:\Users\donhuvy\PycharmProjects\pythonProject\foo\lib\site-packages\numpy\__init__.py&quot;, line 302, in _win_os_check
          raise RuntimeError(msg.format(__file__)) from None
      RuntimeError: The current Numpy installation ('D:\\Users\\donhuvy\\PycharmProjects\\pythonProject\\foo\\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: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  (foo) PS D:\Users\donhuvy\PycharmProjects\pythonProject\foo&gt;
  </code></pre>
  <h3>A screenshot of some of the above text</h3>
  <p><a href="https://i.stack.imgur.com/cyAkM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cyAkM.png" alt="Enter image description here" /></a></p>
  <p>Error information link to <em><a href="https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html" rel="nofollow noreferrer">fmod(), after an update to windows 2004, is causing a strange interaction with other code</a></em></p>
  <p>I use PyCharm 2020.2 Ultimate, and it also catches the error.</p>
  <p>How can I fix it?</p>