Error database

AttributeError: 'super' object has no attribute '__sklearn_tags__'

scikit-learn 1.6 changed its internal tags API, and an older XGBoost or similar wrapper is incompatible with it. Upgrade the wrapper library, or pin scikit-learn below 1.6.

The message you saw
AttributeError: 'super' object has no attribute '__sklearn_tags__'

By Updated

The error

Output
AttributeError: 'super' object has no attribute '__sklearn_tags__'

It typically appears when fitting an XGBoost, LightGBM or other scikit-learn-compatible estimator, or when passing one into cross_val_score, GridSearchCV or a pipeline.

What it means

Libraries like XGBoost provide wrapper classes (XGBClassifier, XGBRegressor) that plug into scikit-learn's ecosystem. That plug-in contract includes an internal "tags" mechanism scikit-learn uses to ask estimators about their capabilities. scikit-learn 1.6 (December 2024) replaced the old tags mechanism with a new one, __sklearn_tags__. Wrappers written against the old contract crash when new scikit-learn calls the new method.

This is a pure version-compatibility clash: new scikit-learn, old wrapper.

Why it happens

You upgraded scikit-learn (or installed a fresh environment that pulled the latest) while an older XGBoost/LightGBM/other wrapper stayed pinned. The error fires only when scikit-learn machinery touches the estimator — plain model.fit(X, y) may work while cross_val_score(model, ...) fails, which makes it look random. It is not random; the CV path exercises the tags API.

How to fix it

1. Upgrade the wrapper library. For XGBoost, compatibility with scikit-learn 1.6 arrived in 2.1.4.

bash
pip install -U xgboost

For LightGBM, CatBoost or another library showing this error, the same move applies — their current releases support the new API.

bash
pip install -U lightgbm catboost

2. Check what you have when unsure which side is old.

bash
pip show scikit-learn xgboost

scikit-learn at 1.6+ with xgboost below 2.1.4 is the broken pairing.

3. If you cannot upgrade the wrapper, pin scikit-learn below 1.6.

bash
pip install "scikit-learn<1.6"

This is the stopgap for frozen environments — record it in requirements.txt with a comment saying why, so someone removes the pin later.

How to prevent it

Upgrade companion libraries together: scikit-learn and everything that wraps it form one compatibility set. A requirements.txt with pinned, tested versions makes environments reproducible, and upgrading becomes a deliberate event instead of a surprise during pip install of something unrelated.

The lessons behind this error.

  • Machine Learning

    XGBoost

    XGBoost grows trees one after another, each one trained on the mistakes the earlier trees left behind, which is why it usually wins on tabular data and why it will overfit if you let it.

Back to all errors