Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TPOT incompatible with current Numpy requirements #1300

Open
gracerxw opened this issue May 22, 2023 · 3 comments
Open

TPOT incompatible with current Numpy requirements #1300

gracerxw opened this issue May 22, 2023 · 3 comments

Comments

@gracerxw
Copy link

gracerxw commented May 22, 2023

Context of the issue

I did a pip install for tpot, however, when it tries to instantiate the class OneHotEncoder, the class has one input parameter of dtype, and it uses np.float. np.float was a deprecated alias for the builtin float.

Process to reproduce the issue

  1. pip install tpot
  2. from tpot import TPOTRegressor
  3. AttributeError: module 'numpy' has no attribute 'float'.
@utkuaslan85
Copy link

utkuaslan85 commented May 22, 2023

I had the same issue. Monkey patching can be solution which is discouraged in general, but seems harmless to me for this case. Please be cautious to use this workaround.

import numpy as np

# Define a new float class that behaves like the built-in float
class MyFloat(float):
    pass

# Monkey patch the numpy module to replace np.float with MyFloat
np.float = MyFloat

# Now when the library code uses np.float, it will be interpreted as MyFloat

Coded by ChatGPT

@sarahyurick
Copy link
Contributor

This was fixed by #1280, but until there's a new tpot release, you'll either have to use a workaround or do a pip install git+ to ensure that you're installing with the latest version available on GitHub.

@bollwyvl
Copy link
Contributor

Looks like the new release is out. One lingering compatibility issue, noted on conda-forge/tpot-feedstock#34, the use of load_boston has been removed from scikit-learn, causing the test suite to fail with the following error:

ERROR: Failure: ImportError (
`load_boston` has been removed from scikit-learn since version 1.2.

We'll do some pins/patches to get it out the door there, and see how it goes 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants