I would like to use scikit-optimize
's BayesSearchCV and using the following package versions in my environment myEnv
:
# Name Version Build Channel
python 3.10.8 h4a9ceb5_0_cpython conda-forge
numpy 1.24.1 pypi_0 pypi
scikit-optimize 0.8.1 pyh9f0ad1d_0 conda-forge
and I am getting the error
AttributeError: module 'numpy' has no attribute 'float'. Did you mean: 'cfloat'?
FYI: The full error message is as follows
Traceback (most recent call last):
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/sklearnex/__main__.py", line 55, in <module>
sys.exit(_main())
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/sklearnex/__main__.py", line 52, in _main
runf(args.name, run_name='__main__')
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/runpy.py", line 289, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "bayes_helper.py", line 26, in <module>
from skopt import BayesSearchCV
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/skopt/__init__.py", line 44, in <module>
from . import callbacks
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/skopt/callbacks.py", line 17, in <module>
from skopt.utils import dump
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/skopt/utils.py", line 19, in <module>
from .sampler import Sobol, Lhs, Hammersly, Halton, Grid
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/skopt/sampler/__init__.py", line 4, in <module>
from .lhs import Lhs
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/skopt/sampler/lhs.py", line 9, in <module>
from ..space import Space, Categorical
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/skopt/space/__init__.py", line 5, in <module>
from .space import *
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/skopt/space/space.py", line 212, in <module>
class Real(Dimension):
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/skopt/space/space.py", line 253, in Real
name=None, dtype=np.float):
File "/home/ec2-user/anaconda3/envs/myEnv/lib/python3.10/site-packages/numpy/__init__.py", line 284, in __getattr__
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'float'. Did you mean: 'cfloat'?
It seems that there is some compatibility issue between my numpy
version and my scikit-optimize
version. But I don't find what it is. In the scikit-optimize documentation it just says that NumPy (>= 1.13.3) is required. Which is the case for me. I also tried it with the very latest version of scikit-optimize
which is 0.0.9, but I still get this error.
Can anyone help me with solving this issue? I can provide any other package version information if needed.