Cannot load LinCE dataset
Opened by finiteautomata (closed)

## Describe the bug

Cannot load LinCE dataset due to a connection error

## Steps to reproduce the bug
```python

from datasets import load_dataset

dataset = load_dataset("lince", "ner_spaeng")
```

A notebook with this code and corresponding error can be found at https://colab.research.google.com/drive/1pgX3bNB9amuUwAVfPFm-XuMV5fEg-cD2

## Expected results

It should load the dataset

## Actual results

```python
---------------------------------------------------------------------------
ConnectionError                           Traceback (most recent call last)
<ipython-input-2-fc551ddcebef> in <module>()
      1 from datasets import load_dataset
      2 
----> 3 dataset = load_dataset("lince", "ner_spaeng")

10 frames
/usr/local/lib/python3.7/dist-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs)
   1682         ignore_verifications=ignore_verifications,
   1683         try_from_hf_gcs=try_from_hf_gcs,
-> 1684         use_auth_token=use_auth_token,
   1685     )
   1686 

/usr/local/lib/python3.7/dist-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs)
    703                     if not downloaded_from_gcs:
    704                         self._download_and_prepare(
--> 705                             dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
    706                         )
    707                     # Sync info

/usr/local/lib/python3.7/dist-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos)
   1219 
   1220     def _download_and_prepare(self, dl_manager, verify_infos):
-> 1221         super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos)
   1222 
   1223     def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable:

/usr/local/lib/python3.7/dist-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs)
    769         split_dict = SplitDict(dataset_name=self.name)
    770         split_generators_kwargs = self._make_split_generators_kwargs(prepare_split_kwargs)
--> 771         split_generators = self._split_generators(dl_manager, **split_generators_kwargs)
    772 
    773         # Checksums verification

/root/.cache/huggingface/modules/datasets_modules/datasets/lince/10d41747f55f0849fa84ac579ea1acfa7df49aa2015b60426bc459c111b3d589/lince.py in _split_generators(self, dl_manager)
    481     def _split_generators(self, dl_manager):
    482         """Returns SplitGenerators."""
--> 483         lince_dir = dl_manager.download_and_extract(f"{_LINCE_URL}/{self.config.name}.zip")
    484         data_dir = os.path.join(lince_dir, self.config.data_dir)
    485         return [

/usr/local/lib/python3.7/dist-packages/datasets/download/download_manager.py in download_and_extract(self, url_or_urls)
    429             extracted_path(s): `str`, extracted paths of given URL(s).
    430         """
--> 431         return self.extract(self.download(url_or_urls))
    432 
    433     def get_recorded_sizes_checksums(self):

/usr/local/lib/python3.7/dist-packages/datasets/download/download_manager.py in download(self, url_or_urls)
    313             num_proc=download_config.num_proc,
    314             disable_tqdm=not is_progress_bar_enabled(),
--> 315             desc="Downloading data files",
    316         )
    317         duration = datetime.now() - start_time

/usr/local/lib/python3.7/dist-packages/datasets/utils/py_utils.py in map_nested(function, data_struct, dict_only, map_list, map_tuple, map_numpy, num_proc, types, disable_tqdm, desc)
    346     # Singleton
    347     if not isinstance(data_struct, dict) and not isinstance(data_struct, types):
--> 348         return function(data_struct)
    349 
    350     disable_tqdm = disable_tqdm or not logging.is_progress_bar_enabled()

/usr/local/lib/python3.7/dist-packages/datasets/download/download_manager.py in _download(self, url_or_filename, download_config)
    333             # append the relative path to the base_path
    334             url_or_filename = url_or_path_join(self._base_path, url_or_filename)
--> 335         return cached_path(url_or_filename, download_config=download_config)
    336 
    337     def iter_archive(self, path_or_buf: Union[str, io.BufferedReader]):

/usr/local/lib/python3.7/dist-packages/datasets/utils/file_utils.py in cached_path(url_or_filename, download_config, **download_kwargs)
    195             use_auth_token=download_config.use_auth_token,
    196             ignore_url_params=download_config.ignore_url_params,
--> 197             download_desc=download_config.download_desc,
    198         )
    199     elif os.path.exists(url_or_filename):

/usr/local/lib/python3.7/dist-packages/datasets/utils/file_utils.py in get_from_cache(url, cache_dir, force_download, proxies, etag_timeout, resume_download, user_agent, local_files_only, use_etag, max_retries, use_auth_token, ignore_url_params, download_desc)
    531         _raise_if_offline_mode_is_enabled(f"Tried to reach {url}")
    532         if head_error is not None:
--> 533             raise ConnectionError(f"Couldn't reach {url} ({repr(head_error)})")
    534         elif response is not None:
    535             raise ConnectionError(f"Couldn't reach {url} (error {response.status_code})")

ConnectionError: Couldn't reach https://ritual.uh.edu/lince/libaccess/eyJ1c2VybmFtZSI6ICJodWdnaW5nZmFjZSBubHAiLCAidXNlcl9pZCI6IDExMSwgImVtYWlsIjogImR1bW15QGVtYWlsLmNvbSJ9/ner_spaeng.zip (ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='ritual.uh.edu', port=443): Max retries exceeded with url: /lince/libaccess/eyJ1c2VybmFtZSI6ICJodWdnaW5nZmFjZSBubHAiLCAidXNlcl9pZCI6IDExMSwgImVtYWlsIjogImR1bW15QGVtYWlsLmNvbSJ9/ner_spaeng.zip (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7feb1c45a690>, 'Connection to ritual.uh.edu timed out. (connect timeout=100)'))")))
```

## Environment info


- `datasets` version: 2.3.2
- Platform: Linux-5.4.188+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.13
- PyArrow version: 6.0.1
- Pandas version: 1.3.5


Comments:
Hi @finiteautomata, thanks for reporting.

Unfortunately, I'm not able to reproduce your issue:
```python
In [1]: from datasets import load_dataset
   ...: dataset = load_dataset("lince", "ner_spaeng")
Downloading builder script: 20.8kB [00:00, 9.09MB/s]                                                                                                                                                       
Downloading metadata: 31.2kB [00:00, 13.5MB/s]                                                                                                                                                             
Downloading and preparing dataset lince/ner_spaeng (download: 2.93 MiB, generated: 18.45 MiB, post-processed: Unknown size, total: 21.38 MiB) to .../.cache/huggingface/datasets/lince/ner_spaeng/1.0.0/10d41747f55f0849fa84ac579ea1acfa7df49aa2015b60426bc459c111b3d589...
Downloading data: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3.08M/3.08M [00:01<00:00, 2.73MB/s]
Dataset lince downloaded and prepared to .../.cache/huggingface/datasets/lince/ner_spaeng/1.0.0/10d41747f55f0849fa84ac579ea1acfa7df49aa2015b60426bc459c111b3d589. Subsequent calls will reuse this data.
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 630.66it/s]

In [2]: dataset
Out[2]: 
DatasetDict({
    train: Dataset({
        features: ['idx', 'words', 'lid', 'ner'],
        num_rows: 33611
    })
    validation: Dataset({
        features: ['idx', 'words', 'lid', 'ner'],
        num_rows: 10085
    })
    test: Dataset({
        features: ['idx', 'words', 'lid', 'ner'],
        num_rows: 23527
    })
})
``` 

Please note that for this dataset, the original data files are not hosted on the Hugging Face Hub, but on https://ritual.uh.edu
And sometimes, the server might be temporarily unavailable, as your error message said (trying to connect to the server timed out):
```
ConnectionError: Couldn't reach https://ritual.uh.edu/lince/libaccess/eyJ1c2VybmFtZSI6ICJodWdnaW5nZmFjZSBubHAiLCAidXNlcl9pZCI6IDExMSwgImVtYWlsIjogImR1bW15QGVtYWlsLmNvbSJ9/ner_spaeng.zip (ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='ritual.uh.edu', port=443): Max retries exceeded with url: /lince/libaccess/eyJ1c2VybmFtZSI6ICJodWdnaW5nZmFjZSBubHAiLCAidXNlcl9pZCI6IDExMSwgImVtYWlsIjogImR1bW15QGVtYWlsLmNvbSJ9/ner_spaeng.zip (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7feb1c45a690>, 'Connection to ritual.uh.edu timed out. (connect timeout=100)'))")))
```
In these cases you could:
- either contact the owners of the data server where the data is hosted to inform them about the issue in their server
- or re-try after waiting some time: usually these issues are just temporary

Great, thanks for checking out!