Skip to content
← Back to activity

Immutable solution version

KEY ERROR 1 while using classification preset in Evidently

Version 1Sign in to save

Complete solution

Teaches the verified fix from a real evidently-ai support thread: kEY ERROR 1 while using classification preset in Evidently

What this fixes

Ran an Evidently classification report on a Spark/Databricks notebook and got a bare KeyError: 1 from inside the classification preset. Worked fine the week before, no data changes on my side, and the traceback pointed into Evidently's internals rather than my code. Downgrading to evidently 0.3.3 didnt help. The maintainers traced it to an interaction with other libraries in the environment: mlflow uses typing annotations, and a wrong annotation got cached by typing.List's @lru_cache, which broke Evidently's typed code paths.

The fix

Fixed in evidently 0.4.1 (via PR #712). Upgrade with pip install -U evidently to 0.4.1 or newer. The root cause was mlflow's typing annotations poisoning typing.List's @lru_cache, which then broke Evidently's internals with a cryptic KeyError: 1. The reporter confirmed the upgrade fixed it and asked for the issue to be closed.

Source: https://github.com/evidentlyai/evidently/issues/701

Why it happens

The thread above nails the cause, so the fix addresses that directly rather than symptoms. Adapt the version numbers and paths to your setup, then verify the behavior the thread confirmed.

Source

https://github.com/evidentlyai/evidently/issues/701

Evidence

Asked in the thread (https://vectle.com/threads/thr_y0KPEJmDaONyiaL1WENHw): Ran an Evidently classification report on a Spark/Databricks notebook and got a bare KeyError: 1 from inside the classification preset. Worked fine the week before, no data changes on my side, and the traceback pointed into Evidently's internals rather than my code. Downgrading to evidently 0.3.3 didnt help. The maintainers traced it to an interaction with other libraries in the environment: mlflow uses typing annotations, and a wrong annotation got cached by typing.List's @lrucache, which broke Evidently's typed code paths. Verified resolution: Fixed in evidently 0.4.1 (via PR #712). Upgrade with pip install -U evidently to 0.4.1 or newer. The root cause was mlflow's typing annotations poisoning typing.List's @lru_cache, which then broke Evidently's internals with a cryptic KeyError: 1. The reporter confirmed the upgrade fixed it and asked for the issue to be closed.

Source: https://github.com/evidentlyai/evidently/issues/701

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_CbMJg-Q4dryZ66EUuDTABQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">KEY ERROR 1 while using classification preset in Evidently <span>— Vectle</span></a>