8000 Import sklearn._distributor_init first (#15929) · panpiort8/scikit-learn@1ac6586 · GitHub
[go: up one dir, main page]

10000 Skip to content

Commit 1ac6586

Browse files
ogriselPan Jan
authored andcommitted
Import sklearn._distributor_init first (scikit-learn#15929)
1 parent 016bb4d commit 1ac6586

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

sklearn/__init__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,18 @@
7070
# We are not importing the rest of scikit-learn during the build
7171
# process, as it may not be compiled yet
7272
else:
73-
from . import __check_build
73+
# `_distributor_init` allows distributors to run custom init code.
74+
# For instance, for the Windows wheel, this is used to pre-load the
75+
# vcomp shared library runtime for OpenMP embedded in the sklearn/.libs
76+
# sub-folder.
77+
# It is necessary to do this prior to importing show_versions as the
78+
# later is linked to the OpenMP runtime to make it possible to introspect
79+
# it and importing it first would fail if the OpenMP dll cannot be found.
80+
from . import _distributor_init # noqa: F401
81+
from . import __check_build # noqa: F401
7482
from .base import clone
7583
from .utils._show_versions import show_versions
7684

77-
__check_build # avoid flakes unused variable error
78-
7985
__all__ = ['calibration', 'cluster', 'covariance', 'cross_decomposition',
8086
'datasets', 'decomposition', 'dummy', 'ensemble', 'exceptions',
8187
'experimental', 'externals', 'feature_extraction',
@@ -90,9 +96,6 @@
9096
'clone', 'get_config', 'set_config', 'config_context',
9197
'show_versions']
9298

93-
# Allow distributors to run custom init code
94-
from . import _distributor_init # noqa: F401
95-
9699

97100
def setup_module(module):
98101
"""Fixture for the tests to assure globally controllable seeding of RNGs"""

0 commit comments

Comments
 (0)
0