Importing sklearn takes too much time compared to other imports except spaCy

### Describe the bug

              Can you open a separate issue please with more details about your problem?

In particular, please include the following information in your new issue:
- is this a regression in scikit-learn 1.5, i.e. did your code work scikit-learn 1.4?
+ I tested other versions still same but it's slower than compared to older versions probably due to new features etc. But 1.5.1 less problematic than 1.5
- ideally a stand-alone snippet that reproduces the behaviour on your machine and that others can try to run. Without a stand-alone snippet to reproduce, there is very little we can do to help ...
`import sklearn` Takes 155 seconds to load. 
`from sklearn.metrics.pairwise import cosine_similarity` 384 seconds in my machine at python 3.12 and scikit-learn version 1.5.1 Windows 11 Latest version of Windows SDK and VM with 8gb ram. Other modules loaded less than 1 seconds. Full code of script: https://github.com/HydraDragonAntivirus/HydraDragonAntivirus/blob/main/antivirus.py
_Originally posted by @lesteve in https://github.com/scikit-learn/scikit-learn/issues/29145#issuecomment-2334105586_


### Steps/Code to Reproduce

`from sklearn.metrics.pairwise import cosine_similarity` 

### Expected Results

Excepted: Loaded in 2 minutes

### Actual Results

Results: `import sklearn` takes 155 seconds, `from sklearn.metrics.pairwise import cosine_similarity` takes 384 seconds

### Versions

```shell
Main machine: 
 python: 3.12.5 (tags/v3.12.5:ff3bc82, Aug  6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)]
executable: c:\Users\victim\AppData\Local\Programs\Python\Python312\python.exe
   machine: Windows-11-10.0.22631-SP0

Python dependencies:
      sklearn: 1.5.1
          pip: 24.2
   setuptools: 73.0.1
        numpy: 1.26.4
        scipy: 1.14.1
       Cython: 3.0.11
       pandas: None
   matplotlib: None
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 16
         prefix: vcomp
       filepath: C:\Users\victim\AppData\Local\Programs\Python\Python312\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libopenblas
       filepath: C:\Users\victim\AppData\Local\Programs\Python\Python312\Lib\site-packages\numpy.libs\libopenblas64__v0.3.23-293-gc2f4bdbb-gcc_10_3_0-2bde3a66a51006b2b53eb373ff767a3f.dll
        version: 0.3.23.dev
threading_layer: pthreads
   architecture: Zen

       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libscipy_openblas
       filepath: C:\Users\victim\AppData\Local\Programs\Python\Python312\Lib\site-packages\scipy.libs\libscipy_openblas-5b1ec8b915dfb81d11cebc0788069d2d.dll
        version: 0.3.27.dev
threading_layer: pthreads
   architecture: Zen
```
Notice: spaCy takes 1469 seconds to load.
Possible solution: Use multithreading or something similar at loading of import.

COMMENT:
Okay I tested it again. It takes a while OS fix himself after you remove MrsMajor5.sys. That's why this happened. Here is there proof (4GB Ram Laptop):
```
time module loaded
sys module loaded in 0.000000 seconds
os module loaded in 0.000000 seconds
shutil module loaded in 0.018122 seconds
subprocess module loaded in 0.004498 seconds
threading module loaded in 0.000000 seconds
re module loaded in 0.000000 seconds
json module loaded in 0.000996 seconds
PySide6.QtWidgets modules loaded in 0.144375 seconds
PySide6.QtCore modules loaded in 0.028394 seconds
PySide6.QtGui.QIcon module loaded in 0.000996 seconds
sklearn module loaded in 1.237146 seconds
joblib module loaded in 0.000000 seconds
pefile module loaded in 0.000998 seconds
zipfile module loaded in 0.000000 seconds
tarfile module loaded in 0.003611 seconds
yara module loaded in 0.002111 seconds
yara_x module loaded in 0.000000 seconds
psutil module loaded in 0.000000 seconds
notifypy.Notify module loaded in 0.030555 seconds
logging module loaded in 0.000000 seconds
concurrent.futures.ThreadPoolExecutor and as_completed loaded in 0.000997 seconds
watchdog.observers.Observer module loaded in 0.010272 seconds
watchdog.events.FileSystemEventHandler module loaded in 0.000000 seconds
time module loaded in 0.000000 seconds
win32file module loaded in 0.002358 seconds
win32con module loaded in 0.001064 seconds
datetime.datetime and timedelta modules loaded in 0.000000 seconds
winreg module loaded in 0.000000 seconds
scapy modules (IP, IPv6, DNS, DNSQR, DNSRR, TCP, UDP, sniff) loaded in 0.454912 seconds
ctypes module loaded in 0.009920 seconds
ipaddress module loaded in 0.000996 seconds
sklearn.metrics.pairwise.cosine_similarity module loaded in 0.073002 seconds
numpy module loaded in 0.000000 seconds
io module loaded in 0.000000 seconds
spacy module loaded in 1.445178 seconds
codecs module loaded in 0.002658 seconds
csv module loaded in 0.000000 seconds
elftools.elf.ELFFile module loaded in 0.062695 seconds
struct module loaded in 0.000000 seconds
zlib module loaded in 0.003044 seconds
marshal module loaded in 0.000000 seconds
base64 module loaded in 0.000000 seconds
base32_crockford module loaded in 0.002045 seconds
binascii module loaded in 0.000000 seconds
Total time for all imports: 3.585918 seconds
```
Edit: Virustotal link of malware is here: https://www.virustotal.com/gui/file/f5321a094b42d8da0e79fc3b56179d9d91c29fb9df8eb135bbebdd71f3811b76/detection
Edit 2: If you have problem just wait at first attempt because second attempt much more faster.

Labels: Bug, Needs Info