Does the error get raised while building or when running?
Building
To Reproduce
A minimal example file:
from sklearn.preprocessing import StandardScaler
data = [[0, 0], [0, 0], [1, 1], [1, 1]]
scaler = StandardScaler()
scaler.fit(data)
PyInstaller command:
pyinstaller --clean --onefile test.py
Error:
47783 WARNING: Hidden import "sklearn.neighbors._typedefs" not found!
Expected behavior
I expected that, if I added --hidden-import="sklearn.neighbors._typedefs" to my pyinstaller command, that I would no longer receive the warning, but it persisted, leading me to look closer into the cause of the warning. I expected my sklearn version (version 1.3.2) to require sklean.neighbords._typedefs, but I found that it was removed in version 1.0.2.
Screenshots
Desktop (please complete the following information):
OS: Windows
Python Version: 3.11.7
Version of pyinstaller-hooks-contrib: 2023.10
Version of PyInstaller 6.1.0
Additional context
I propose the solution of editing lines 17-28 of hook-sklearn.neighbors.py as follows
if is_module_satisfies("scikit_learn > 1.0.1"):
# 1.0.2 and later
hiddenimports += [
'sklearn.neighbors._quad_tree',
]
elif is_module_satisfies("scikit_learn < 0.22 "):
# 0.21 and below
hiddenimports += [
'sklearn.neighbors.typedefs',
'sklearn.neighbors.quad_tree',
]
else:
# between and including 0.22 and 1.0.1
hiddenimports += [
'sklearn.neighbors._typedefs',
'sklearn.neighbors._quad_tree',
]
Describe the bug The module sklearn.neighbors._typedef was removed from the sklearn package in 1.0.2 Present in 1.0.1 Removed in 1.0.2
The hidden imports in hook-sklearn.neighbors.py require
sklearn.neighbors._typedef
for all versions >=0.22, so a warning is thrownWhich hook/library isn't working? hook-sklearn.neighbors.py
Does the error get raised while building or when running? Building
To Reproduce
A minimal example file:
PyInstaller command:
Error:
Expected behavior I expected that, if I added
--hidden-import="sklearn.neighbors._typedefs"
to my pyinstaller command, that I would no longer receive the warning, but it persisted, leading me to look closer into the cause of the warning. I expected my sklearn version (version 1.3.2) to require sklean.neighbords._typedefs, but I found that it was removed in version 1.0.2.Screenshots
Desktop (please complete the following information):
pyinstaller-hooks-contrib
: 2023.10Additional context I propose the solution of editing lines 17-28 of hook-sklearn.neighbors.py as follows