alteryx / evalml

EvalML is an AutoML library written in python.
https://evalml.alteryx.com
BSD 3-Clause "New" or "Revised" License
785 stars 87 forks source link

EvalML fails with Featuretools < 1.16.0, current version specifier is too loose #3822

Closed AlifCor closed 2 years ago

AlifCor commented 2 years ago

Problem

The current version constraint for Featuretools is featuretools >= 1.7.0, < 1.17.0. However, it seems that EvalML is not compatible with Featuretools < 1.16.0.

The following error is raised when importing the latest version of EvalML with Featuretools < 1.16.0 (1.7.0, 1.14.0 and 1.15.0 have been tried):

Traceback (most recent call last):
  File "[...]/evalml/__init__.py", line 9, in <module>
    import evalml.model_understanding
  File "[...]/evalml/model_understanding/__init__.py", line 39, in <module>
    from evalml.model_understanding.decision_boundary import (
  File "[...]/evalml/model_understanding/decision_boundary.py", line 7, in <module>
    from evalml.pipelines import BinaryClassificationPipeline
  File "[...]/evalml/pipelines/__init__.py", line 2, in <module>
    from evalml.pipelines.components import (
  File "[...]/evalml/pipelines/components/__init__.py", line 3, in <module>
    from evalml.pipelines.components.estimators import (
  File "[...]/evalml/pipelines/components/estimators/__init__.py", line 3, in <module>
    from evalml.pipelines.components.estimators.classifiers import (
  File "[...]/evalml/pipelines/components/estimators/classifiers/__init__.py", line 8, in <module>
    from evalml.pipelines.components.estimators.classifiers.xgboost_classifier import (
  File "[...]/evalml/pipelines/components/estimators/classifiers/xgboost_classifier.py", line 9, in <module>
    from evalml.pipelines.components.transformers import LabelEncoder
  File "[...]/evalml/pipelines/components/transformers/__init__.py", line 35, in <module>
    from evalml.pipelines.components.transformers.preprocessing import (
  File "[...]/evalml/pipelines/components/transformers/preprocessing/__init__.py", line 12, in <module>
    from evalml.pipelines.components.transformers.preprocessing.natural_language_featurizer import (
  File "[...]/evalml/pipelines/components/transformers/preprocessing/natural_language_featurizer.py", line 5, in <module>
    from featuretools.primitives import (
ImportError: cannot import name 'MeanCharactersPerWord' from 'featuretools.primitives' ([...]/featuretools/primitives/__init__.py)

Reproducible example

$ pip install featuretools==1.15.0 evalml
[...]
$ pip show evalml | grep Version
Version: 0.62.0
$ pip show featuretools | grep Version
Version: 1.15.0
$ python -c "import evalml"
Traceback (most recent call last):
[...]
$ pip install featuretools==1.16.0 evalml
[...]
$ python -c "import evalml"
[No errors]

Suggested fix

Enforcing Featuretools >= 1.16.0 in setup.cfg

Possible work-around for users

When installing EvalML, your dependency manager (e.g. Poetry) might resolve Featuretools to a version older than 1.16.0 (which happened to me in a complex project with many dependencies). In that case, you can explicitly add Featuretools >= 1.16.0 to your dependencies to force a compatible version. See the following pyproject.toml example for Poetry:

# ...
[tool.poetry.dependencies]
evalml = "^0.6.2"
featuretools = ">=1.16.0"
# ...
thehomebrewnerd commented 2 years ago

@AlifCor This is a little tricky, but in this case the error is actually caused by the versions of featuretools and nlp-primitives that are getting installed, and not an incompatibility between EvalML and Featuretools.

If you want to use a version of Featuretools <1.16.0 you also need to downgrade your installed version of nlp-primitives to be <2.9.0 and everything should work fine.

thehomebrewnerd commented 2 years ago

@AlifCor After some further discussion, we decided to go ahead with your suggestion and bump the minimum Featuretools version to 0.16.0. This change will be included in the next release of EvalML and will resolve this issue.

Thank you for reporting this and bringing it to our attention!