Import sklearn._distributor_init first
@@ -70,12 +70,18 @@ if __SKLEARN_SETUP__:
# We are not importing the rest of scikit-learn during the build
# process, as it may not be compiled yet
else:
- from . import __check_build
+ # `_distributor_init` allows distributors to run custom init code.
+ # For instance, for the Windows wheel, this is used to pre-load the
+ # vcomp shared library runtime for OpenMP embedded in the sklearn/.libs
+ # sub-folder.
+ # It is necessary to do this prior to importing show_versions as the
+ # later is linked to the OpenMP runtime to make it possible to introspect
+ # it and importing it first would fail if the OpenMP dll cannot be found.
+ from . import _distributor_init # noqa: F401
+ from . import __check_build # noqa: F401
from .base import clone
from .utils._show_versions import show_versions
- __check_build # avoid flakes unused variable error
-
__all__ = ['calibration', 'cluster', 'covariance', 'cross_decomposition',
'datasets', 'decomposition', 'dummy', 'ensemble', 'exceptions',
'experimental', 'externals', 'feature_extraction',
@@ -90,9 +96,6 @@ else:
'clone', 'get_config', 'set_config', 'config_context',
'show_versions']
- # Allow distributors to run custom init code
- from . import _distributor_init # noqa: F401
-
def setup_module(module):
"""Fixture for the tests to assure globally controllable seeding of RNGs"""
