TypeError: cpu_count() got an unexpected keyword argument 'only_physical_cores'

### Describe the bug

I am running the KNeighbordsClassifier inside a framework of pytorch_lightning. I am fitting the model correctly, but when I try to predict new results I have an error.

### Steps/Code to Reproduce

```python
estimators = dict(svm=SVC(kernel='rbf', C=1e5, gamma=1.),
                  knn=KNeighborsClassifier(n_neighbors=3))

for key, estimator in estimators.items():
    estimator.fit(x_train, c_train)
    c_hat_test = np.concatenate([estimator.predict(x_te) for x_te in x_test_split], axis=0)
```

### Expected Results

No error is thrown

### Actual Results

```python
File "sklearn/metrics/_pairwise_distances_reduction/_argkmin.pyx", line 556, in sklearn.metrics._pairwise_distances_reduction._argkmin.ArgKmin32.compute
  File "sklearn/metrics/_pairwise_distances_reduction/_argkmin.pyx", line 820, in sklearn.metrics._pairwise_distances_reduction._argkmin.EuclideanArgKmin32.__init__
  File "sklearn/metrics/_pairwise_distances_reduction/_argkmin.pyx", line 590, in sklearn.metrics._pairwise_distances_reduction._argkmin.ArgKmin32.__init__
  File "sklearn/metrics/_pairwise_distances_reduction/_base.pyx", line 547, in sklearn.metrics._pairwise_distances_reduction._base.BaseDistancesReduction32.__init__
  File "sklearn/utils/_openmp_helpers.pyx", line 21, in sklearn.utils._openmp_helpers._openmp_effective_n_threads
  File "sklearn/utils/_openmp_helpers.pyx", line 68, in sklearn.utils._openmp_helpers._openmp_effective_n_threads
TypeError: cpu_count() got an unexpected keyword argument 'only_physical_cores'
```

### Versions

```shell
System:
    python: 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0]
executable: /home/myuser/anaconda3/envs/pt12/bin/python
   machine: Linux-6.5.0-21-generic-x86_64-with-glibc2.35
Python dependencies:
      sklearn: 1.4.1.post1
          pip: 23.3.1
   setuptools: 68.2.2
        numpy: 1.26.4
        scipy: 1.12.0
       Cython: 3.0.8
       pandas: 2.2.1
   matplotlib: 3.8.3
       joblib: 1.3.2
threadpoolctl: 3.3.0
Built with OpenMP: True
threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 12
         prefix: libgomp
       filepath: /home/myuser/anaconda3/envs/pt12/lib/python3.10/site-packages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0
        version: None
       user_api: blas
   internal_api: openblas
    num_threads: 12
         prefix: libopenblas
       filepath: /home/myuser/anaconda3/envs/pt12/lib/python3.10/site-packages/numpy.libs/libopenblas64_p-r0-0cf96a72.3.23.dev.so
        version: 0.3.23.dev
threading_layer: pthreads
   architecture: Zen
       user_api: blas
   internal_api: openblas
    num_threads: 12
         prefix: libopenblas
       filepath: /home/myuser/anaconda3/envs/pt12/lib/python3.10/site-packages/scipy.libs/libopenblasp-r0-23e5df77.3.21.dev.so
        version: 0.3.21.dev
threading_layer: pthreads
   architecture: Zen
```

COMMENT:
> TypeError: cpu_count() got an unexpected keyword argument 'only_physical_cores'

`cpu_count` comes from joblib and the ``only_physical_cores`` arg was added a while ago. Looks like you have the latest version 1.3.2, which indeed has the arg: https://github.com/joblib/joblib/blob/6310841f66352bbf958cc190a973adcca611f4c7/joblib/parallel.py#L615

@Enmartz could you please provide additional details about how the libraries are installed ?

Labels: Bug