You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用AutoML库EvalML时遇ImportError问题求解决方案

解决EvalML导入时的DiversityScore导入错误

这个错误是因为EvalML依赖的Featuretools版本与当前安装的Featuretools版本不兼容——EvalML试图从featuretools.primitives导入DiversityScore,但该类在当前Featuretools版本中已被移除或转移到其他模块。以下是可行的解决方案:

  • 匹配Featuretools与EvalML的兼容版本
    先查看EvalML官方要求的Featuretools依赖版本:

    pip show evalml
    

    在输出的Requires字段中找到Featuretools的版本范围,然后安装对应版本的Featuretools:

    pip install featuretools==[指定兼容版本号]
    

    例如,若EvalML 0.40.x要求Featuretools 1.10.x,执行pip install featuretools==1.10.0即可。

  • 降级EvalML到兼容版本
    若不想改动Featuretools版本,可降级EvalML到与当前Featuretools匹配的版本。先确认当前Featuretools版本:

    pip show featuretools
    

    再查找EvalML的版本历史,找到依赖该Featuretools版本的EvalML版本并安装:

    pip install evalml==[指定兼容版本号]
    
  • 临时手动修正导入路径(不推荐)
    若Featuretools只是将DiversityScore转移到了子模块(比如featuretools.primitives.natural_language),可临时修改EvalML的导入文件:
    打开路径/usr/local/lib/python3.10/dist-packages/evalml/pipelines/components/transformers/preprocessing/natural_language_featurizer.py,将第5行的导入语句修改为:

    from featuretools.primitives.natural_language import DiversityScore
    

    注意:此方法在重新安装EvalML后会失效,仅适合临时应急使用。

内容的提问来源于stack exchange,提问作者Dibyajyoti Sahoo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 20:33:14