# Can't import load\_metric from datasets

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-import-load-metric-from-datasets%2F107524%3E%5C
**Category:** 🤗Datasets\
**Created:** [September 20, 2024, 7:15pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-import-load-metric-from-datasets%2F107524 "2024-09-20T19:15:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![toddglidden](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@toddglidden](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftoddglidden)%5C
**Post date:** [September 20, 2024, 7:15pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-import-load-metric-from-datasets%2F107524%2F1 "2024-09-20T19:15:01Z")

</div>

Hi. I’m trying to follow this tutorial: [Getting Started with Sentiment Analysis using Python (huggingface.co)](https://huggingface.co/blog/sentiment-analysis-python)

When running this line: from datasets import load\_metric

I get an import error. “load\_metric” isn’t found.

Any thoughts?

---

<div class="post-metadata">

**Author:** ![severo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/severo/32/27449_2.png) [@severo](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsevero)%5C
**Post date:** [September 23, 2024, 11:57am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-import-load-metric-from-datasets%2F107524%2F2 "2024-09-23T11:57:33Z")

</div>

Support for `load_metric` has been removed in datasets@3.0.0, see [Release 3.0.0 · huggingface/datasets · GitHub](https://github.com/huggingface/datasets/releases/tag/3.0.0).

You now have to use the evaluate library: [🤗 Evaluate](https://huggingface.co/docs/evaluate)

---

<div class="post-metadata">

**Author:** ![toddglidden](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@toddglidden](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftoddglidden)%5C
**Post date:** [September 23, 2024, 5:16pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-import-load-metric-from-datasets%2F107524%2F3 "2024-09-23T17:16:30Z")

</div>

Thanks! I’ll look into that!

---

<div class="post-metadata">

**Author:** ![Whenzi](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@Whenzi](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FWhenzi)%5C
**Post date:** [November 14, 2024, 1:01pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-import-load-metric-from-datasets%2F107524%2F4 "2024-11-14T13:01:41Z")

</div>

## Try the following:

### pip install evaluate

### import evaluate

### metric = evaluate.load(“accuracy”)

---

<div class="post-metadata">

**Author:** ![ohnoadrummer](https://avatars.discourse-cdn.com/v4/letter/o/ce73a5/32.png) [@ohnoadrummer](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fohnoadrummer)%5C
**Post date:** [February 22, 2025, 4:57pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-import-load-metric-from-datasets%2F107524%2F5 "2025-02-22T16:57:14Z")

</div>

@Whenzi This is great, thanks! I got my code working with your two lines and the following within the compute\_metrics function

```auto
    # load_accuracy = load_metric("accuracy")
    # load_f1 = load_metric("f1")
    load_accuracy = evaluate.load("accuracy")
    load_f1 = evaluate.load("f1")

```
