[2.6.1][2.7.0] Upgrade `datasets` to fix `TypeError: can only concatenate str (not "int") to str`
Opened by lhoestq (open)

`datasets` 2.6.1 and 2.7.0 started to stop supporting datasets like IMDB, ConLL or MNIST datasets.

When loading a dataset using 2.6.1 or 2.7.0, you may this error when loading certain datasets:
```python
TypeError: can only concatenate str (not "int") to str
```

This is because we started to update the metadata of those datasets to a format that is not supported in 2.6.1 and 2.7.0
This change is required or those datasets won't be supported by the Hugging Face Hub.

Therefore if you encounter this error or if you're using `datasets` 2.6.1 or 2.7.0, we encourage you to update to a newer version.
For example, versions 2.6.2 and 2.7.1 patch this issue.

```python
pip install -U datasets
```

All the datasets affected are the ones with a ClassLabel feature type and YAML "dataset_info" metadata. More info [here](https://github.com/huggingface/datasets/issues/5275).

We apologize for the inconvenience.

Comments:
I still get this error on 2.9.0
<img width="1925" alt="image" src="https://user-images.githubusercontent.com/7208470/215597359-2f253c76-c472-4612-8099-d3a74d16eb29.png">


Hi ! I just tested locally and or colab and it works fine for 2.9 on `sst2`.

Also the code that is shown in your stack trace is not present in the 2.9 source code - so I'm wondering how you installed `datasets` that could cause this ? (you can check by searching for `[0:{label_ids[-1] + 1}]` in the [2.9 codebase](https://github.dev/huggingface/datasets/tree/b5672a956d5de864e6f5550e493527d962d6ae55) - it doesn't find anything)

Anyway you can try uninstalling `datasets` and install it again

For what it's worth, I've also gotten this error on 2.9.0, and I've tried uninstalling an reinstalling
![Screenshot 2023-02-01 at 11 06 55 AM](https://user-images.githubusercontent.com/22944438/216126466-6934e8f8-0be4-41f4-9822-8436dfafd61c.png)

I'm very new to this package (I was following this tutorial: https://huggingface.co/docs/transformers/training), so there's a good chance I was doing something wrong 😅 but thought I'd pass along the feedback

@ntrpnr @mtwichel Did you install `datasets` with conda ?

I suspect that `datasets` 2.9 on conda still have this issue for some reason. When I install `datasets` with `pip` I don't have this error.

> @ntrpnr @mtwichel Did you install datasets with conda ?

I did yeah, I wonder if that's the issue

I just checked on conda at https://anaconda.org/HuggingFace/datasets/files

and everything looks fine, I got
```python

f"ClassLabel expected a value for all label ids [0:{int(label_ids[-1]) + 1}] but some ids are missing."
```
as expected in features.py line 1760 (notice the "int()") to not have the TypeError.

From where on conda did you install `datasets` ? You should use the `HuggingFace` official channel

edit: the conda-forge one [here](https://anaconda.org/conda-forge/datasets/files) seems ok as well

Could you also try this in your notebook ? In case your python kernel doesn't match the `pip` environment in your shell
```python
import datasets; datasets.__version__
```
and
```
!which python
```
```python
import sys; sys.executable
```

Mmmm, just a potential clue:

Where are you running your Python code? Is it the Spyder IDE?

I have recently seen some users reporting conflicting Python environments while using Spyder...

Maybe related:
- #5487

Other potential clue:
- Had you already imported `datasets` before pip-updating it? You should first update datasets, before importing it. Otherwise, you need to restart the kernel after updating it.

I installed `datasets` with Conda using `conda install datasets` and got this issue.

Then I tried to reinstall using
`
conda install -c huggingface -c conda-forge datasets
`
The issue is now fixed.

I'm still getting this error on 2.13.0