AttributeError: 'NoneType' object has no attribute 'split'  when running K-means Clustering

### Discussed in https://github.com/scikit-learn/scikit-learn/discussions/27182

<div type='discussions-op-text'>

<sup>Originally posted by **Somesh140** August 27, 2023</sup>

```python
`# elbow method
clustering_score = []

for i in range(1,11):
    kmeans = KMeans(n_clusters=i,init = 'random',n_init='auto',random_state = 42)
    kmeans.fit(X)
    clustering_score.append(kmeans.inertia_)
```

On executing the above code for Kmeans I am getting the following error.

```pytb
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_29680\750678575.py in <module>
      4 for i in range(1,11):
      5     kmeans = KMeans(n_clusters=i,init = 'random',n_init='auto',random_state = 42)
----> 6     kmeans.fit(X)
      7     clustering_score.append(kmeans.inertia_)

~\anaconda3\lib\site-packages\sklearn\base.py in wrapper(estimator, *args, **kwargs)
   1149                 )
   1150             ):
-> 1151                 return fit_method(estimator, *args, **kwargs)
   1152 
   1153         return wrapper

~\anaconda3\lib\site-packages\sklearn\cluster\_kmeans.py in fit(self, X, y, sample_weight)
   1507         else:
   1508             kmeans_single = _kmeans_single_lloyd
-> 1509             self._check_mkl_vcomp(X, X.shape[0])
   1510 
   1511         best_inertia, best_labels = None, None

~\anaconda3\lib\site-packages\sklearn\cluster\_kmeans.py in _check_mkl_vcomp(self, X, n_samples)
    925         n_active_threads = int(np.ceil(n_samples / CHUNK_SIZE))
    926         if n_active_threads < self._n_threads:
--> 927             modules = threadpool_info()
    928             has_vcomp = "vcomp" in [module["prefix"] for module in modules]
    929             has_mkl = ("mkl", "intel") in [

~\anaconda3\lib\site-packages\sklearn\utils\fixes.py in threadpool_info()
     81         return controller.info()
     82     else:
---> 83         return threadpoolctl.threadpool_info()
     84 
     85 

~\anaconda3\lib\site-packages\threadpoolctl.py in threadpool_info()
    122     In addition, each module may contain internal_api specific entries.
    123     """
--> 124     return _ThreadpoolInfo(user_api=_ALL_USER_APIS).todicts()
    125 
    126 

~\anaconda3\lib\site-packages\threadpoolctl.py in __init__(self, user_api, prefixes, modules)
    338 
    339             self.modules = []
--> 340             self._load_modules()
    341             self._warn_if_incompatible_openmp()
    342         else:

~\anaconda3\lib\site-packages\threadpoolctl.py in _load_modules(self)
    371             self._find_modules_with_dyld()
    372         elif sys.platform == "win32":
--> 373             self._find_modules_with_enum_process_module_ex()
    374         else:
    375             self._find_modules_with_dl_iterate_phdr()

~\anaconda3\lib\site-packages\threadpoolctl.py in _find_modules_with_enum_process_module_ex(self)
    483 
    484                 # Store the module if it is supported and selected
--> 485                 self._make_module_from_path(filepath)
    486         finally:
    487             kernel_32.CloseHandle(h_process)

~\anaconda3\lib\site-packages\threadpoolctl.py in _make_module_from_path(self, filepath)
    513             if prefix in self.prefixes or user_api in self.user_api:
    514                 module_class = globals()[module_class]
--> 515                 module = module_class(filepath, prefix, user_api, internal_api)
    516                 self.modules.append(module)
    517 

~\anaconda3\lib\site-packages\threadpoolctl.py in __init__(self, filepath, prefix, user_api, internal_api)
    604         self.internal_api = internal_api
    605         self._dynlib = ctypes.CDLL(filepath, mode=_RTLD_NOLOAD)
--> 606         self.version = self.get_version()
    607         self.num_threads = self.get_num_threads()
    608         self._get_extra_info()

~\anaconda3\lib\site-packages\threadpoolctl.py in get_version(self)
    644                              lambda: None)
    645         get_config.restype = ctypes.c_char_p
--> 646         config = get_config().split()
    647         if config[0] == b"OpenBLAS":
    648             return config[1].decode("utf-8")

AttributeError: 'NoneType' object has no attribute 'split'

This was not the case a few months back 
```

sklearn.__version__=1.3.0</div>

COMMENT:
Thanks for the report @Somesh140. This is a bug in threadpoolctl, I will open an issue upstream.

Could you please post the output of `conda list` or `pip freeze`?

How did you install scikit-learn, numpy and scipy? Using anaconda directly? Or pip?

Labels: Needs Triage