Here is the full error traceback:
Traceback (most recent call last):
File "C:\Users\david\github\beluga3\SCRATCHPAPER_6.py", line 4, in <module>
from MLModule.AI.featuretoolstpot.ml_framework import MyMLModeler
File "C:\Users\david\github\beluga3\MLModule\AI\featuretoolstpot\ml_framework.py", line 8, in <module>
from tpot import TPOTClassifier
File "C:\Users\david\AppData\Local\Programs\Python\Python310\lib\site-packages\tpot\__init__.py", line 27, in <module>
from .tpot import TPOTClassifier, TPOTRegressor
File "C:\Users\david\AppData\Local\Programs\Python\Python310\lib\site-packages\tpot\tpot.py", line 31, in <module>
from .base import TPOTBase
File "C:\Users\david\AppData\Local\Programs\Python\Python310\lib\site-packages\tpot\base.py", line 70, in <module>
from .builtins import CombineDFs, StackingEstimator
File "C:\Users\david\AppData\Local\Programs\Python\Python310\lib\site-packages\tpot\builtins\__init__.py", line 29, in <module>
from .one_hot_encoder import OneHotEncoder, auto_select_categorical_features, _transform_selected
File "C:\Users\david\AppData\Local\Programs\Python\Python310\lib\site-packages\tpot\builtins\one_hot_encoder.py", line 136, in <module>
class OneHotEncoder(BaseEstimator, TransformerMixin):
File "C:\Users\david\AppData\Local\Programs\Python\Python310\lib\site-packages\tpot\builtins\one_hot_encoder.py", line 216, in OneHotEncoder
def __init__(self, categorical_features='auto', dtype=np.float,
File "C:\Users\david\AppData\Local\Programs\Python\Python310\lib\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'?
As you can see, when it tries to instantiate the class OneHotEncoder, the class has one input parameter of dtype, and it uses np.float. But apparently numpy has no such attribute. I checked all my dependencies, and made sure everything was upgrade.
I'm running Python 3.10.2
Any help would be great.
This issue happens when using tpot with numpy 1.24. This version of numpy has removed type aliases, like
np.float. This was already declared as deprecated since version 1.20, and now it has been removed.The developers of tpot should modify their code to avoid this issue. But, as a solution for the time being you can avoid the issue by simply using a version of numpy <1.24
More info on this issue and how to fix this in your own code can be found here.