<h4 dir="auto">Description</h4>
<p dir="auto">When I try to build scikit-learn on NixOS with numpy/scipy compiled with MKL, the build succeeds but tests fail:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="=================================== FAILURES ===================================
_________________________________ test_omp_cv __________________________________

    def test_omp_cv():
        y_ = y[:, 0]
        gamma_ = gamma[:, 0]
        ompcv = OrthogonalMatchingPursuitCV(normalize=True, fit_intercept=False,
                                            max_iter=10, cv=5)
        ompcv.fit(X, y_)
&gt;       assert_equal(ompcv.n_nonzero_coefs_, n_nonzero_coefs)

/nix/store/7sz7kr8szqhmy75mx2hxbfz3wvgq2iyx-python3.7-scikit-learn-0.21.2/lib/python3.7/site-packages/sklearn/linear_model/tests/test_omp.py:208:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/4g2ilwnk4mj4g68rc52kygx7gcqxnjd0-python3-3.7.5/lib/python3.7/unittest/case.py:852: in assertEqual
    assertion_func(first, second, msg=msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = &lt;sklearn.utils._unittest_backport.TestCase testMethod=__init__&gt;
first = 6, second = 5, msg = '6 != 5'

    def _baseAssertEqual(self, first, second, msg=None):
        &quot;&quot;&quot;The default assertEqual implementation, not type specific.&quot;&quot;&quot;
        if not first == second:
            standardMsg = '%s != %s' % _common_shorten_repr(first, second)
            msg = self._formatMessage(msg, standardMsg)
&gt;           raise self.failureException(msg)
E           AssertionError: 6 != 5

/nix/store/4g2ilwnk4mj4g68rc52kygx7gcqxnjd0-python3-3.7.5/lib/python3.7/unittest/case.py:845: AssertionError"><pre class="notranslate"><code class="notranslate">=================================== FAILURES ===================================
_________________________________ test_omp_cv __________________________________

    def test_omp_cv():
        y_ = y[:, 0]
        gamma_ = gamma[:, 0]
        ompcv = OrthogonalMatchingPursuitCV(normalize=True, fit_intercept=False,
                                            max_iter=10, cv=5)
        ompcv.fit(X, y_)
&gt;       assert_equal(ompcv.n_nonzero_coefs_, n_nonzero_coefs)

/nix/store/7sz7kr8szqhmy75mx2hxbfz3wvgq2iyx-python3.7-scikit-learn-0.21.2/lib/python3.7/site-packages/sklearn/linear_model/tests/test_omp.py:208:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/4g2ilwnk4mj4g68rc52kygx7gcqxnjd0-python3-3.7.5/lib/python3.7/unittest/case.py:852: in assertEqual
    assertion_func(first, second, msg=msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = &lt;sklearn.utils._unittest_backport.TestCase testMethod=__init__&gt;
first = 6, second = 5, msg = '6 != 5'

    def _baseAssertEqual(self, first, second, msg=None):
        """The default assertEqual implementation, not type specific."""
        if not first == second:
            standardMsg = '%s != %s' % _common_shorten_repr(first, second)
            msg = self._formatMessage(msg, standardMsg)
&gt;           raise self.failureException(msg)
E           AssertionError: 6 != 5

/nix/store/4g2ilwnk4mj4g68rc52kygx7gcqxnjd0-python3-3.7.5/lib/python3.7/unittest/case.py:845: AssertionError
</code></pre></div>
<h4 dir="auto">Steps/Code to Reproduce</h4>
<p dir="auto">Using nix, can reproduce with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; curl https://nixos.org/nix/install | sh # install nix (follow instructions if needed)
&gt;  nix-shell -p 'python3.withPackages(ps: with ps; [ scikitlearn ])'
[success]
&gt;  nix-shell -p '(python37.override {packageOverrides = self: super: { numpy = super.numpy.override { blas = mkl;}; }; } ).withPackages(ps: with ps; [ scikitlearn ])'
[fail]"><pre class="notranslate"><code class="notranslate">&gt; curl https://nixos.org/nix/install | sh # install nix (follow instructions if needed)
&gt;  nix-shell -p 'python3.withPackages(ps: with ps; [ scikitlearn ])'
[success]
&gt;  nix-shell -p '(python37.override {packageOverrides = self: super: { numpy = super.numpy.override { blas = mkl;}; }; } ).withPackages(ps: with ps; [ scikitlearn ])'
[fail]
</code></pre></div>
<p dir="auto">full output: <a href="https://gist.github.com/tbenst/f32351229c0330edf3aefa003e6c1053">https://gist.github.com/tbenst/f32351229c0330edf3aefa003e6c1053</a></p>
<p dir="auto">Thanks for any tips / pointers!</p>
<h4 dir="auto">Versions</h4>
<p dir="auto">python: 3.7.5<br>
scikit-learn: 0.21.2<br>
numpy: 1.17.3<br>
scipy: 1.3.1</p>
<p dir="auto">In newly released scikit-learn 0.20.1 (and actually in 0.20.0) <strong>test_omp_cv</strong> case fails during running test suite. Any help appreciated!</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="_______________________________ test_omp_cv _______________________________

    def test_omp_cv():
        y_ = y[:, 0]
        gamma_ = gamma[:, 0]
        ompcv = OrthogonalMatchingPursuitCV(normalize=True, fit_intercept=False,
                                            max_iter=10, cv=5)
        ompcv.fit(X, y_)
&gt;       assert_equal(ompcv.n_nonzero_coefs_, n_nonzero_coefs)

/usr/local/lib/python3.6/dist-packages/scikit_learn-0.20.1-py3.6-linux-x86_64.egg/sklearn/linear_model/tests/test_omp.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.6/unittest/case.py:829: in assertEqual
    assertion_func(first, second, msg=msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = &lt;sklearn.utils._unittest_backport.TestCase testMethod=__init__&gt;, first = 6, second = 5, msg = '6 != 5'

    def _baseAssertEqual(self, first, second, msg=None):
        &quot;&quot;&quot;The default assertEqual implementation, not type specific.&quot;&quot;&quot;
        if not first == second:
            standardMsg = '%s != %s' % _common_shorten_repr(first, second)
            msg = self._formatMessage(msg, standardMsg)
&gt;           raise self.failureException(msg)
E           AssertionError: 6 != 5

/usr/lib/python3.6/unittest/case.py:822: AssertionError"><pre class="notranslate"><code class="notranslate">_______________________________ test_omp_cv _______________________________

    def test_omp_cv():
        y_ = y[:, 0]
        gamma_ = gamma[:, 0]
        ompcv = OrthogonalMatchingPursuitCV(normalize=True, fit_intercept=False,
                                            max_iter=10, cv=5)
        ompcv.fit(X, y_)
&gt;       assert_equal(ompcv.n_nonzero_coefs_, n_nonzero_coefs)

/usr/local/lib/python3.6/dist-packages/scikit_learn-0.20.1-py3.6-linux-x86_64.egg/sklearn/linear_model/tests/test_omp.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.6/unittest/case.py:829: in assertEqual
    assertion_func(first, second, msg=msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = &lt;sklearn.utils._unittest_backport.TestCase testMethod=__init__&gt;, first = 6, second = 5, msg = '6 != 5'

    def _baseAssertEqual(self, first, second, msg=None):
        """The default assertEqual implementation, not type specific."""
        if not first == second:
            standardMsg = '%s != %s' % _common_shorten_repr(first, second)
            msg = self._formatMessage(msg, standardMsg)
&gt;           raise self.failureException(msg)
E           AssertionError: 6 != 5

/usr/lib/python3.6/unittest/case.py:822: AssertionError
</code></pre></div>
<h4 dir="auto">Versions</h4>
<p dir="auto">System:<br>
python: 3.6.7 (default, Oct 22 2018, 11:32:17)  [GCC 8.2.0]<br>
executable: /usr/bin/python3<br>
machine: Linux-4.15.0-39-generic-x86_64-with-Ubuntu-18.04-bionic</p>
<p dir="auto">BLAS:<br>
macros: SCIPY_MKL_H=None, HAVE_CBLAS=None<br>
lib_dirs: /opt/intel/mkl/lib/intel64<br>
cblas_libs: mkl_rt, pthread</p>
<p dir="auto">Python deps:<br>
pip: 18.1<br>
setuptools: 40.6.2<br>
sklearn: 0.20.1<br>
numpy: 1.15.4<br>
scipy: 1.1.0<br>
Cython: 0.29<br>
pandas: None</p>