Title: load_dataset fails with FileNotFound error on Windows
Author: joelkowalewski (NONE)
State: closed
Created: 2023-04-10T23:21:12Z

### Describe the bug

Although I can import and run the datasets library in a Colab environment, I cannot successfully load any data on my own machine (Windows 10) despite following the install steps:

(1) create conda environment 
(2) activate environment
(3) install with: ``conda` install -c huggingface -c conda-forge datasets`

Then

```
from datasets import load_dataset

# this or any other example from the website fails with the FileNotFoundError
 glue = load_dataset("glue", "ax")
```

**Below I have pasted the error omitting the full path**:

```
raise FileNotFoundError(
FileNotFoundError: Couldn't find a dataset script at C:\Users\...\glue\glue.py or any data file in the same directory. Couldn't find 'glue' on the Hugging Face Hub either: FileNotFoundError: [WinError 3] The system cannot find the path specified: 
'C:\\Users\\...\\.cache\\huggingface'
```


### Steps to reproduce the bug

On Windows 10 

1) create a minimal conda environment (with just Python)
(2) activate environment
(3) install datasets with: ``conda` install -c huggingface -c conda-forge datasets`
(4) import load_dataset and follow example usage from any dataset card. 

### Expected behavior

The expected behavior is to load the file into the Python session running on my machine without error. 

### Environment info

```
# Name                    Version                   Build  Channel
aiohttp                   3.8.4           py311ha68e1ae_0    conda-forge
aiosignal                 1.3.1              pyhd8ed1ab_0    conda-forge
arrow-cpp                 11.0.0          h57928b3_13_cpu    conda-forge
async-timeout             4.0.2              pyhd8ed1ab_0    conda-forge
attrs                     22.2.0             pyh71513ae_0    conda-forge
aws-c-auth                0.6.26               h1262f0c_1    conda-forge
aws-c-cal                 0.5.21               h7cda486_2    conda-forge
aws-c-common              0.8.14               hcfcfb64_0    conda-forge
aws-c-compression         0.2.16               h8a79959_5    conda-forge
aws-c-event-stream        0.2.20               h5f78564_4    conda-forge
aws-c-http                0.7.6                h2545be9_0    conda-forge
aws-c-io                  0.13.19              h0d2781e_3    conda-forge
aws-c-mqtt                0.8.6               hd211e0c_12    conda-forge
aws-c-s3                  0.2.7                h8113e7b_1    conda-forge
aws-c-sdkutils            0.1.8                h8a79959_0    conda-forge
aws-checksums             0.1.14               h8a79959_5    conda-forge
aws-crt-cpp               0.19.8              he6d3b81_12    conda-forge
aws-sdk-cpp               1.10.57              h64004b3_8    conda-forge
brotlipy                  0.7.0           py311ha68e1ae_1005    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
c-ares                    1.19.0               h2bbff1b_0
ca-certificates           2023.01.10           haa95532_0
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py311h7d9ee11_3    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
cryptography              40.0.1          py311h28e9c30_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
datasets                  2.11.0                     py_0    huggingface
dill                      0.3.6              pyhd8ed1ab_1    conda-forge
filelock                  3.11.0             pyhd8ed1ab_0    conda-forge
frozenlist                1.3.3           py311ha68e1ae_0    conda-forge
fsspec                    2023.4.0           pyh1a96a4e_0    conda-forge
gflags                    2.2.2             ha925a31_1004    conda-forge
glog                      0.6.0                h4797de2_0    conda-forge
huggingface_hub           0.13.4                     py_0    huggingface
idna                      3.4                pyhd8ed1ab_0    conda-forge
importlib-metadata        6.3.0              pyha770c72_0    conda-forge
importlib_metadata        6.3.0                hd8ed1ab_0    conda-forge
intel-openmp              2023.0.0         h57928b3_25922    conda-forge
krb5                      1.20.1               heb0366b_0    conda-forge
libabseil                 20230125.0      cxx17_h63175ca_1    conda-forge
libarrow                  11.0.0          h04c43f8_13_cpu    conda-forge
libblas                   3.9.0              16_win64_mkl    conda-forge
libbrotlicommon           1.0.9                hcfcfb64_8    conda-forge
libbrotlidec              1.0.9                hcfcfb64_8    conda-forge
libbrotlienc              1.0.9                hcfcfb64_8    conda-forge
libcblas                  3.9.0              16_win64_mkl    conda-forge
libcrc32c                 1.1.2                h0e60522_0    conda-forge
libcurl                   7.88.1               h68f0423_1    conda-forge
libexpat                  2.5.0                h63175ca_1    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libgoogle-cloud           2.8.0                hf2ff781_1    conda-forge
libgrpc                   1.52.1               h32da247_1    conda-forge
libhwloc                  2.9.0                h51c2c0f_0    conda-forge
libiconv                  1.17                 h8ffe710_0    conda-forge
liblapack                 3.9.0              16_win64_mkl    conda-forge
libprotobuf               3.21.12              h12be248_0    conda-forge
libsqlite                 3.40.0               hcfcfb64_0    conda-forge
libssh2                   1.10.0               h9a1e1f7_3    conda-forge
libthrift                 0.18.1               h9ce19ad_0    conda-forge
libutf8proc               2.8.0                h82a8f57_0    conda-forge
libxml2                   2.10.3               hc3477c8_6    conda-forge
libzlib                   1.2.13               hcfcfb64_4    conda-forge
lz4-c                     1.9.4                hcfcfb64_0    conda-forge
mkl                       2022.1.0           h6a75c08_874    conda-forge
multidict                 6.0.4           py311ha68e1ae_0    conda-forge
multiprocess              0.70.14         py311ha68e1ae_3    conda-forge
numpy                     1.24.2          py311h0b4df5a_0    conda-forge
openssl                   3.1.0                hcfcfb64_0    conda-forge
orc                       1.8.3                hada7b9e_0    conda-forge
packaging                 23.0               pyhd8ed1ab_0    conda-forge
pandas                    2.0.0           py311hf63dbb6_0    conda-forge
parquet-cpp               1.5.1                         2    conda-forge
pip                       23.0.1             pyhd8ed1ab_0    conda-forge
pthreads-win32            2.9.1                hfa6e2cd_3    conda-forge
pyarrow                   11.0.0          py311h6a6099b_13_cpu    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyopenssl                 23.1.1             pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyh0701188_6    conda-forge
python                    3.11.3          h2628c8c_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-tzdata             2023.3             pyhd8ed1ab_0    conda-forge
python-xxhash             3.2.0           py311ha68e1ae_0    conda-forge
python_abi                3.11                    3_cp311    conda-forge
pytz                      2023.3             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0             py311ha68e1ae_5    conda-forge
re2                       2023.02.02           h63175ca_0    conda-forge
requests                  2.28.2             pyhd8ed1ab_1    conda-forge
setuptools                67.6.1             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.1.10               hfb803bf_0    conda-forge
tbb                       2021.8.0             h91493d7_0    conda-forge
tk                        8.6.12               h8ffe710_0    conda-forge
tqdm                      4.65.0             pyhd8ed1ab_1    conda-forge
typing-extensions         4.5.0                hd8ed1ab_0    conda-forge
typing_extensions         4.5.0              pyha770c72_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
urllib3                   1.26.15            pyhd8ed1ab_0    conda-forge
vc                        14.3                hb6edc58_10    conda-forge
vs2015_runtime            14.34.31931         h4c5c07a_10    conda-forge
wheel                     0.40.0             pyhd8ed1ab_0    conda-forge
win_inet_pton             1.1.0              pyhd8ed1ab_6    conda-forge
xxhash                    0.8.1                hcfcfb64_0    conda-forge
xz                        5.2.10               h8cc25b3_1
yaml                      0.2.5                h8ffe710_2    conda-forge
yarl                      1.8.2           py311ha68e1ae_0    conda-forge
zipp                      3.15.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               hcfcfb64_4    conda-forge
zstd                      1.5.4                hd43e919_0
```

Comments:
Hi! Can you please paste the entire error stack trace, not only the last few lines?

`----> 1 dataset = datasets.load_dataset("glue", "ax")

File ~\anaconda3\envs\huggingface\Lib\site-packages\datasets\load.py:1767, in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, num_proc, storage_options, **config_kwargs)
   1762 verification_mode = VerificationMode(
   1763     (verification_mode or VerificationMode.BASIC_CHECKS) if not save_infos else VerificationMode.ALL_CHECKS
   1764 )
   1766 # Create a dataset builder
-> 1767 builder_instance = load_dataset_builder(
   1768     path=path,
   1769     name=name,
   1770     data_dir=data_dir,
   1771     data_files=data_files,
   1772     cache_dir=cache_dir,
   1773     features=features,
   1774     download_config=download_config,
   1775     download_mode=download_mode,
   1776     revision=revision,
   1777     use_auth_token=use_auth_token,
   1778     storage_options=storage_options,
   1779     **config_kwargs,
   1780 )
   1782 # Return iterable dataset in case of streaming
   1783 if streaming:

File ~\anaconda3\envs\huggingface\Lib\site-packages\datasets\load.py:1498, in load_dataset_builder(path, name, data_dir, data_files, cache_dir, features, download_config, download_mode, revision, use_auth_token, storage_options, **config_kwargs)
   1496     download_config = download_config.copy() if download_config else DownloadConfig()
   1497     download_config.use_auth_token = use_auth_token
-> 1498 dataset_module = dataset_module_factory(
   1499     path,
   1500     revision=revision,
   1501     download_config=download_config,
   1502     download_mode=download_mode,
   1503     data_dir=data_dir,
   1504     data_files=data_files,
   1505 )
   1507 # Get dataset builder class from the processing script
   1508 builder_cls = import_main_class(dataset_module.module_path)

File ~\anaconda3\envs\huggingface\Lib\site-packages\datasets\load.py:1211, in dataset_module_factory(path, revision, download_config, download_mode, dynamic_modules_path, data_dir, data_files, **download_kwargs)
   1209                 raise e1 from None
   1210             if isinstance(e1, FileNotFoundError):
-> 1211                 raise FileNotFoundError(
   1212                     f"Couldn't find a dataset script at {relative_to_absolute_path(combined_path)} or any data file in the same directory. "
   1213                     f"Couldn't find '{path}' on the Hugging Face Hub either: {type(e1).__name__}: {e1}"
   1214                 ) from None
   1215             raise e1 from None
   1216 else:`

Okay, this is the issue:
```
FileNotFoundError: [WinError 3] The system cannot find the path specified: 
'C:\\Users\\...\\.cache\\huggingface'
``` 

I don't remember seeing this error before.

I guess it could happen in a multi-process environment if one of the processes deletes the `datasets` cache as the other one is loading a dataset (with `load_dataset`), so make sure that's not the case. Also, you can disable the Windows max path length limit (if enabled), but this is most likely not the problem.

Closing due to inactivity.