Can't import datasets AttributeError: partially initialized module 'datasets' has no attribute 'utils' (most likely due to a circular import)
MEMBER
Thanks for reporting, @OPterminator.

However, we are not able to reproduce this issue.

There might be 2 reasons why you get this exception:
- Either the name of your local Python file: if it is called  `datasets.py` this could generate a circular import when trying to import the Hugging Face `datasets` library.
  - You could try to rename it and run it again.
- Another cause could be the simultaneous use of the packages `nlp` and `datasets`. Please note that we renamed the Hugging Face `nlp` library to `datasets` more than 2 years ago: they are 2 versions of the same library.
  - Please try to update your script and use only `datasets` (`nlp` name is no longer in use and is out of date).
2022-08-29T05:23:16Z
https://github.com/huggingface/datasets/issues/4906#issuecomment-1229791249
https://api.github.com/repos/huggingface/datasets/issues/4906
IC_kwDODunzps5JTSAR
https://api.github.com/repos/huggingface/datasets/issues/comments/1229791249/reactions
2022-08-29T05:23:16Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1229791249
https://avatars.githubusercontent.com/u/8515462?v=4
https://api.github.com/users/albertvillanova/events{/privacy}
https://api.github.com/users/albertvillanova/followers
https://api.github.com/users/albertvillanova/following{/other_user}
https://api.github.com/users/albertvillanova/gists{/gist_id}
https://github.com/albertvillanova
albertvillanova
MDQ6VXNlcjg1MTU0NjI=
https://api.github.com/users/albertvillanova/orgs
https://api.github.com/users/albertvillanova/received_events
https://api.github.com/users/albertvillanova/repos
https://api.github.com/users/albertvillanova/starred{/owner}{/repo}
https://api.github.com/users/albertvillanova/subscriptions
User
https://api.github.com/users/albertvillanova
public
NONE
i am also facing this issue


```
----> 1 import datasets
      3 dataset = datasets.load_dataset("ucberkeley-dlab/measuring-hate-speech", "binary")
      4 df = dataset["train"].to_pandas()

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/datasets/__init__.py:52
     50 from .fingerprint import disable_caching, enable_caching, is_caching_enabled, set_caching_enabled
     51 from .info import DatasetInfo, MetricInfo
---> 52 from .inspect import (
     53     get_dataset_config_info,
     54     get_dataset_config_names,
     55     get_dataset_infos,
     56     get_dataset_split_names,
     57     inspect_dataset,
     58     inspect_metric,
     59     list_datasets,
     60     list_metrics,
     61 )
     62 from .iterable_dataset import IterableDataset
     63 from .load import load_dataset, load_dataset_builder, load_from_disk, load_metric

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/datasets/inspect.py:30
     28 from .download.streaming_download_manager import StreamingDownloadManager
...
---> 16 logger = datasets.utils.logging.get_logger(__name__)
     19 if datasets.config.PYARROW_VERSION.major >= 7:
     21     def pa_table_to_pylist(table):
```
2023-01-12T23:23:41Z
https://github.com/huggingface/datasets/issues/4906#issuecomment-1381100667
https://api.github.com/repos/huggingface/datasets/issues/4906
IC_kwDODunzps5SUex7
https://api.github.com/repos/huggingface/datasets/issues/comments/1381100667/reactions
2023-01-12T23:23:41Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1381100667
https://avatars.githubusercontent.com/u/18241005?v=4
https://api.github.com/users/burhankhanzada/events{/privacy}
https://api.github.com/users/burhankhanzada/followers
https://api.github.com/users/burhankhanzada/following{/other_user}
https://api.github.com/users/burhankhanzada/gists{/gist_id}
https://github.com/burhankhanzada
burhankhanzada
MDQ6VXNlcjE4MjQxMDA1
https://api.github.com/users/burhankhanzada/orgs
https://api.github.com/users/burhankhanzada/received_events
https://api.github.com/users/burhankhanzada/repos
https://api.github.com/users/burhankhanzada/starred{/owner}{/repo}
https://api.github.com/users/burhankhanzada/subscriptions
User
https://api.github.com/users/burhankhanzada
public
NONE
I am facing the same question. And this happens when i installing `evaluate` package while `jupyter notebook` running. I'm not sure if the error occured because of trying to import the package installed when the notebook is running.  Surpringly when i stop the notebook and rerun, the issue has been solved itself. Hope this will be helpful : )
2023-03-29T14:47:30Z
https://github.com/huggingface/datasets/issues/4906#issuecomment-1488769278
https://api.github.com/repos/huggingface/datasets/issues/4906
IC_kwDODunzps5YvND-
https://api.github.com/repos/huggingface/datasets/issues/comments/1488769278/reactions
2023-03-29T14:47:30Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1488769278
https://avatars.githubusercontent.com/u/71917718?v=4
https://api.github.com/users/Baxkiller/events{/privacy}
https://api.github.com/users/Baxkiller/followers
https://api.github.com/users/Baxkiller/following{/other_user}
https://api.github.com/users/Baxkiller/gists{/gist_id}
https://github.com/Baxkiller
Baxkiller
MDQ6VXNlcjcxOTE3NzE4
https://api.github.com/users/Baxkiller/orgs
https://api.github.com/users/Baxkiller/received_events
https://api.github.com/users/Baxkiller/repos
https://api.github.com/users/Baxkiller/starred{/owner}{/repo}
https://api.github.com/users/Baxkiller/subscriptions
User
https://api.github.com/users/Baxkiller
public
NONE
I also got this error.
It helped me to find the python process and kill it, then restart the kernel and the error disappeared.
2023-04-11T16:31:05Z
https://github.com/huggingface/datasets/issues/4906#issuecomment-1503731061
https://api.github.com/repos/huggingface/datasets/issues/4906
IC_kwDODunzps5ZoR11
https://api.github.com/repos/huggingface/datasets/issues/comments/1503731061/reactions
2023-04-11T16:31:05Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1503731061
https://avatars.githubusercontent.com/u/167288?v=4
https://api.github.com/users/beshkenadze/events{/privacy}
https://api.github.com/users/beshkenadze/followers
https://api.github.com/users/beshkenadze/following{/other_user}
https://api.github.com/users/beshkenadze/gists{/gist_id}
https://github.com/beshkenadze
beshkenadze
MDQ6VXNlcjE2NzI4OA==
https://api.github.com/users/beshkenadze/orgs
https://api.github.com/users/beshkenadze/received_events
https://api.github.com/users/beshkenadze/repos
https://api.github.com/users/beshkenadze/starred{/owner}{/repo}
https://api.github.com/users/beshkenadze/subscriptions
User
https://api.github.com/users/beshkenadze
public
NONE
> I also got this error. It helped me to find the python process and kill it, then restart the kernel and the error disappeared.

Yes!
2023-05-13T13:53:30Z
https://github.com/huggingface/datasets/issues/4906#issuecomment-1546658108
https://api.github.com/repos/huggingface/datasets/issues/4906
IC_kwDODunzps5cMCE8
https://api.github.com/repos/huggingface/datasets/issues/comments/1546658108/reactions
2023-05-13T13:53:30Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1546658108
https://avatars.githubusercontent.com/u/24466630?v=4
https://api.github.com/users/ShuningCui/events{/privacy}
https://api.github.com/users/ShuningCui/followers
https://api.github.com/users/ShuningCui/following{/other_user}
https://api.github.com/users/ShuningCui/gists{/gist_id}
https://github.com/ShuningCui
ShuningCui
MDQ6VXNlcjI0NDY2NjMw
https://api.github.com/users/ShuningCui/orgs
https://api.github.com/users/ShuningCui/received_events
https://api.github.com/users/ShuningCui/repos
https://api.github.com/users/ShuningCui/starred{/owner}{/repo}
https://api.github.com/users/ShuningCui/subscriptions
User
https://api.github.com/users/ShuningCui
public
NONE
> I am facing the same question. And this happens when i installing `evaluate` package while `jupyter notebook` running. I'm not sure if the error occured because of trying to import the package installed when the notebook is running. Surpringly when i stop the notebook and rerun, the issue has been solved itself. Hope this will be helpful : )

Thank you! :)
2023-10-27T20:08:28Z
https://github.com/huggingface/datasets/issues/4906#issuecomment-1783447215
https://api.github.com/repos/huggingface/datasets/issues/4906
IC_kwDODunzps5qTT6v
https://api.github.com/repos/huggingface/datasets/issues/comments/1783447215/reactions
2023-10-27T20:08:28Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1783447215
https://avatars.githubusercontent.com/u/20797621?v=4
https://api.github.com/users/lnxdx/events{/privacy}
https://api.github.com/users/lnxdx/followers
https://api.github.com/users/lnxdx/following{/other_user}
https://api.github.com/users/lnxdx/gists{/gist_id}
https://github.com/lnxdx
lnxdx
MDQ6VXNlcjIwNzk3NjIx
https://api.github.com/users/lnxdx/orgs
https://api.github.com/users/lnxdx/received_events
https://api.github.com/users/lnxdx/repos
https://api.github.com/users/lnxdx/starred{/owner}{/repo}
https://api.github.com/users/lnxdx/subscriptions
User
https://api.github.com/users/lnxdx
public
NONE
Yes, i met the same error when import pandas after restarting computers. 
AttributeError: partially initialized module 'pandas' has no attribute '_pandas_parser_CAPI' (most likely due to a circular import)
some think pandas.py file need to be found and delete, i tried but it did not work.
however, restarted the kernel and solved it!!! 
Thanks very much
2024-11-16T08:59:16Z
https://github.com/huggingface/datasets/issues/4906#issuecomment-2480485052
https://api.github.com/repos/huggingface/datasets/issues/4906
IC_kwDODunzps6T2TK8
https://api.github.com/repos/huggingface/datasets/issues/comments/2480485052/reactions
2024-11-16T08:59:16Z
https://api.github.com/repos/huggingface/datasets/issues/comments/2480485052
https://avatars.githubusercontent.com/u/167068918?v=4
https://api.github.com/users/Gloriacyy/events{/privacy}
https://api.github.com/users/Gloriacyy/followers
https://api.github.com/users/Gloriacyy/following{/other_user}
https://api.github.com/users/Gloriacyy/gists{/gist_id}
https://github.com/Gloriacyy
Gloriacyy
U_kgDOCfVE9g
https://api.github.com/users/Gloriacyy/orgs
https://api.github.com/users/Gloriacyy/received_events
https://api.github.com/users/Gloriacyy/repos
https://api.github.com/users/Gloriacyy/starred{/owner}{/repo}
https://api.github.com/users/Gloriacyy/subscriptions
User
https://api.github.com/users/Gloriacyy
public
## Describe the bug
A clear and concise description of what the bug is.
Not able to import datasets 
## Steps to reproduce the bug
```python
# Sample code to reproduce the bug
import os
os.environ["WANDB_API_KEY"] = "0" ## to silence warning
import numpy as np
import random
import sklearn
import matplotlib.pyplot as plt
import pandas as pd
import sys
import tensorflow as tf
import plotly.express as px
import transformers
import tokenizers
import nlp as nlp
import utils
import datasets
```

## Expected results
A clear and concise description of the expected results.
import should work normal
## Actual results
Specify the actual results or traceback.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-21-b3b5b0b62103> in <module>
     13 import nlp as nlp
     14 import utils
---> 15 import datasets

~\anaconda3\lib\site-packages\datasets\__init__.py in <module>
     44 from .fingerprint import disable_caching, enable_caching, is_caching_enabled, set_caching_enabled
     45 from .info import DatasetInfo, MetricInfo
---> 46 from .inspect import (
     47     get_dataset_config_info,
     48     get_dataset_config_names,

~\anaconda3\lib\site-packages\datasets\inspect.py in <module>
     28 from .download.streaming_download_manager import StreamingDownloadManager
     29 from .info import DatasetInfo
---> 30 from .load import dataset_module_factory, import_main_class, load_dataset_builder, metric_module_factory
     31 from .utils.file_utils import relative_to_absolute_path
     32 from .utils.logging import get_logger

~\anaconda3\lib\site-packages\datasets\load.py in <module>
     53 from .iterable_dataset import IterableDataset
     54 from .metric import Metric
---> 55 from .packaged_modules import (
     56     _EXTENSION_TO_MODULE,
     57     _MODULE_SUPPORTS_METADATA,

~\anaconda3\lib\site-packages\datasets\packaged_modules\__init__.py in <module>
      4 from typing import List
      5 
----> 6 from .csv import csv
      7 from .imagefolder import imagefolder
      8 from .json import json

~\anaconda3\lib\site-packages\datasets\packaged_modules\csv\csv.py in <module>
     13 
     14 
---> 15 logger = datasets.utils.logging.get_logger(__name__)
     16 
     17 _PANDAS_READ_CSV_NO_DEFAULT_PARAMETERS = ["names", "prefix"]

AttributeError: partially initialized module 'datasets' has no attribute 'utils' (most likely due to a circular import)

## Environment info
<!-- You can run the command `datasets-cli env` and copy-and-paste its output below. -->
Copy-and-paste the text below in your GitHub issue.

- `datasets` version: 2.4.0
- Platform: Windows-10-10.0.22000-SP0
- Python version: 3.8.8
- PyArrow version: 9.0.0
- Pandas version: 1.2.4
