Repository: numpy/numpy
File: numpy/_core/__init__.py (Python)

Code before:
# disables OpenBLAS affinity setting of the main thread that limits
# python threads or processes to one core
env_added = []
for envkey in ['OPENBLAS_MAIN_FREE', 'GOTOBLAS_MAIN_FREE']:
    if envkey not in os.environ:
        os.environ[envkey] = '1'
        env_added.append(envkey)

try:
    from . import multiarray
except ImportError as exc:
    import sys

    # Basically always, the problem should be that the C module is wrong/missing...
    if (
        isinstance(exc, ModuleNotFoundError)
        and exc.name == "numpy._core._multiarray_umath"
    ):
        import sys
        candidates = []
        for path in __path__:
            candidates.extend(
                f for f in os.listdir(path) if f.startswith("_multiarray_umath"))
        if len(candidates) == 0:
            bad_c_module_info = (
                "We found no compiled module, was NumPy build successfully?\n")
        else:
            candidate_str = '\n  * '.join(candidates)
            # cache_tag is documented to be possibly None, so just use name if it is
            # this guesses at cache_tag being the same as the extension module scheme
            tag = sys.implementation.cache_tag or sys.implementation.name
            bad_c_module_info = (
                f"The following compiled module files exist, but seem incompatible\n"
                f"with with either python '{tag}' or the "
                f"platform '{sys.platform}':\n\n  * {candidate_str}\n"
            )
    else:
        bad_c_module_info = ""

    major, minor, *_ = sys.version_info
    msg = f"""

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
{bad_c_module_info}
We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Review comment (suggestion):
tiny nit as I really shouldn't even be here 😄 :
```suggestion
                "We found no compiled module, did NumPy build successfully?\n")
```

Code after:
# disables OpenBLAS affinity setting of the main thread that limits
# python threads or processes to one core
env_added = []
for envkey in ['OPENBLAS_MAIN_FREE', 'GOTOBLAS_MAIN_FREE']:
    if envkey not in os.environ:
        os.environ[envkey] = '1'
        env_added.append(envkey)

try:
    from . import multiarray
except ImportError as exc:
    import sys

    # Basically always, the problem should be that the C module is wrong/missing...
    if (
        isinstance(exc, ModuleNotFoundError)
        and exc.name == "numpy._core._multiarray_umath"
    ):
        import sys
        candidates = []
        for path in __path__:
            candidates.extend(
                f for f in os.listdir(path) if f.startswith("_multiarray_umath"))
        if len(candidates) == 0:
            bad_c_module_info = (
                "We found no compiled module, did NumPy build successfully?\n")
        else:
            candidate_str = '\n  * '.join(candidates)
            # cache_tag is documented to be possibly None, so just use name if it is
            # this guesses at cache_tag being the same as the extension module scheme
            tag = sys.implementation.cache_tag or sys.implementation.name
            bad_c_module_info = (
                f"The following compiled module files exist, but seem incompatible\n"
                f"with with either python '{tag}' or the "
                f"platform '{sys.platform}':\n\n  * {candidate_str}\n"
            )
    else:
        bad_c_module_info = ""

    major, minor, *_ = sys.version_info
    msg = f"""

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
{bad_c_module_info}
We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html