Issue 1:
We are building a Numpy python wheel from source, and binding it to a version of MKL that is installed on our cluster. Since Numpy 1.19, a single test fails when running numpy.test() :

> assert info.get_lib_dirs() == lib_dirs
E AssertionError: assert ['/cvmfs/soft.../lib/intel64'] == ['/tmp/tmpwmv.../tmprf9ssim6']
E At index 0 diff: '/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2019.2.187/mkl/lib/intel64' != '/tmp/tmpwmvc9p10'
E Right contains one more item: '/tmp/tmprf9ssim6'
E Full diff:
E - ['/tmp/tmpwmvc9p10', '/tmp/tmprf9ssim6']
E + ['/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2019.2.187/mkl/lib/intel64']

Now, obviously, the path returned by info.get_lib_dirs() is the correct one, it should not find libraries in /tmp/....

Why is this test failing ?

Note that 10895 other tests pass correctly.

Issue 2:
python-3.8.3, numpy 1.19.0

numpy is compiled against intel mkl 2018.2.199 (newer versions of mkl + numpy => nvidia's nvblas no longer work )

OS ubuntu linux.

>>>np.show_config()
blas_mkl_info:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/opt/intel/mkl/lib/intel64/']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/opt/intel/mkl/include']
blas_opt_info:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/opt/intel/mkl/lib/intel64/']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/opt/intel/mkl/include']
lapack_mkl_info:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/opt/intel/mkl/lib/intel64/']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/opt/intel/mkl/include']
lapack_opt_info:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/opt/intel/mkl/lib/intel64/']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/opt/intel/mkl/include']
>>> np.__version__
'1.19.0'

Running np.test() produces one error:

TestSystemInfoReading.test_overrides _____________________

self = <numpy.distutils.tests.test_system_info.TestSystemInfoReading object at 0x7f36d855d640>

def test_overrides(self):
previousDir = os.getcwd()
cfg = os.path.join(self._dir1, 'site.cfg')
shutil.copy(self._sitecfg, cfg)
try:
os.chdir(self._dir1)
# Check that the '[ALL]' section does not override
# missing values from other sections
info = mkl_info()
lib_dirs = info.cp['ALL']['library_dirs'].split(os.pathsep)
assert info.get_lib_dirs() != lib_dirs

# But if we copy the values to a '[mkl]' section the value
# is correct
with open(cfg, 'r') as fid:
mkl = fid.read().replace('ALL', 'mkl')
with open(cfg, 'w') as fid:
fid.write(mkl)
info = mkl_info()
assert info.get_lib_dirs() == lib_dirs

# Also, the values will be taken from a section named '[DEFAULT]'
with open(cfg, 'r') as fid:
dflt = fid.read().replace('mkl', 'DEFAULT')
with open(cfg, 'w') as fid:
fid.write(dflt)
info = mkl_info()
> assert info.get_lib_dirs() == lib_dirs
E AssertionError: assert ['/opt/intel/...lib/intel64/'] == ['/tmp/tmp_gt.../tmp0ntuctr2']
E At index 0 diff: '/opt/intel/mkl/lib/intel64/' != '/tmp/tmp_gtgtt2a'
E Right contains one more item: '/tmp/tmp0ntuctr2'
E Full diff:
E - ['/tmp/tmp_gtgtt2a', '/tmp/tmp0ntuctr2']
E + ['/opt/intel/mkl/lib/intel64/']

cfg = '/tmp/tmp_gtgtt2a/site.cfg'
dflt = '\n[DEFAULT]\nlibrary_dirs = /tmp/tmp_gtgtt2a:/tmp/tmp0ntuctr2\nlibraries = /tmp/tmp_gtgtt2a/libfoo.so,/tmp/tmp0ntuctr.../tmp0ntuctr2\n\n[duplicate_options]\nmylib_libs = /tmp/tmp_gtgtt2a/libfoo.so\nlibraries = /tmp/tmp0ntuctr2/libbar.so\n'
fid = <_io.TextIOWrapper name='/tmp/tmp_gtgtt2a/site.cfg' mode='w' encoding='UTF-8'>
info = <numpy.distutils.system_info.mkl_info object at 0x7f36d8570be0>
lib_dirs = ['/tmp/tmp_gtgtt2a', '/tmp/tmp0ntuctr2']
mkl = '\n[mkl]\nlibrary_dirs = /tmp/tmp_gtgtt2a:/tmp/tmp0ntuctr2\nlibraries = /tmp/tmp_gtgtt2a/libfoo.so,/tmp/tmp0ntuctr2/li.../tmp0ntuctr2\n\n[duplicate_options]\nmylib_libs = /tmp/tmp_gtgtt2a/libfoo.so\nlibraries = /tmp/tmp0ntuctr2/libbar.so\n'
previousDir = '/home/bernard/opt/python38'
self = <numpy.distutils.tests.test_system_info.TestSystemInfoReading object at 0x7f36d855d640>

lib/python3.8/site-packages/numpy/distutils/tests/test_system_info.py:284: AssertionError