ImportError: cannot import name 'Dataset'
## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.2.1, datasets : 1.2.1
- Platform: Linux AI-LAB 5.3.0-42-generic #34~18.04.1-Ubuntu SMP Fri Feb 28 13:42:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Python version: 3.6.8
- PyTorch version (GPU?): 1.7.1
- Tensorflow version (GPU?):
- Using GPU in script?:
- Using distributed or parallel set-up in script?:

### Who can help
Anyone.

## Information
Completely install Transformers + datasets. by pip command


The problem arises when using:
When i try to import Lib:
from transformers import AutoTokenizer, AutoModel
## Error like this:

```
ImportError                               Traceback (most recent call last)
<ipython-input-2-c6bea6c01ce9> in <module>
----> 1 from transformers import AutoTokenizer, AutoModel

/usr/local/lib/python3.6/dist-packages/transformers/__init__.py in __getattr__(self, name)
   2096             if name == "__version__":
   2097                 return __version__
-> 2098             return super().__getattr__(name)
   2099 
   2100     sys.modules[__name__] = _LazyModule(__name__, _import_structure)

/usr/local/lib/python3.6/dist-packages/transformers/file_utils.py in __getattr__(self, name)
   1463         elif name in self._class_to_module.keys():
   1464             module = self._get_module(self._class_to_module[name])
-> 1465             value = getattr(module, name)
   1466         else:
   1467             raise AttributeError(f"module {self.__name__} has no attribute {name}")

/usr/local/lib/python3.6/dist-packages/transformers/file_utils.py in __getattr__(self, name)
   1462             value = self._get_module(name)
   1463         elif name in self._class_to_module.keys():
-> 1464             module = self._get_module(self._class_to_module[name])
   1465             value = getattr(module, name)
   1466         else:

/usr/local/lib/python3.6/dist-packages/transformers/models/auto/__init__.py in _get_module(self, module_name)
    158 
    159         def _get_module(self, module_name: str):
--> 160             return importlib.import_module("." + module_name, self.__name__)
    161 
    162     sys.modules[__name__] = _LazyModule(__name__, _import_structure)

/usr/lib/python3.6/importlib/__init__.py in import_module(name, package)
    124                 break
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 
    128 

/usr/local/lib/python3.6/dist-packages/transformers/models/auto/modeling_auto.py in <module>
    152 from ..pegasus.modeling_pegasus import PegasusForConditionalGeneration, PegasusModel
    153 from ..prophetnet.modeling_prophetnet import ProphetNetForCausalLM, ProphetNetForConditionalGeneration, ProphetNetModel
--> 154 from ..rag.modeling_rag import (  # noqa: F401 - need to import all RagModels to be in globals() function
    155     RagModel,
    156     RagSequenceForGeneration,

/usr/local/lib/python3.6/dist-packages/transformers/models/rag/modeling_rag.py in <module>
     27 from ...utils import logging
     28 from .configuration_rag import RagConfig
---> 29 from .retrieval_rag import RagRetriever
     30 
     31 

/usr/local/lib/python3.6/dist-packages/transformers/models/rag/retrieval_rag.py in <module>
     37 
     38 if is_datasets_available():
---> 39     from datasets import Dataset, load_dataset, load_from_disk
     40 
     41 if is_faiss_available():

ImportError: cannot import name 'Dataset'
```


Thanks 
Nakarin
How did you install Transformers and Datasets? Could you post your `pip list` here?<|||||>> How did you install Transformers and Datasets? Could you post your `pip list` here?

transformers (4.2.1)
datasets (1.2.1)

Sorry, for reply late.<|||||>Hmmm, I cannot seem to be able to reproduce your issue. When I install transformers and datasets, I can import `Dataset`, and I don't get a crash like you have. 

Can you open a colab notebook that reproduces it?<|||||>I try to downgrade datasets to version 1.2.0 and import transformers, it seems no problem, then I upgrade datasets to 1.2.1 again and try to use transformers it works like a charm. 

>>> import transformers
>>> import datasets
>>> import simpletransformers
>>> transformers.__version__
'4.2.0'
>>> dtasets.__version__
'1.2.1'
>>>

Thank you for your time.
Nakarin<|||||>Fantastic, great that you got it to work! Closing this for now, feel free to re-open if you face the issue again.<|||||>This issue still persists even after trying above methods.  <|||||>ImportError: cannot import name 'DatasetInfo' from 'huggingface_hub.hf_api'  
I occured the same issue when I am trying to import keyBERT package, and my `pip list` is as follow:
keybert : 0.5.0
transformers : 4.15.0 
<|||||>Could you try upgrading `huggingface_hub` to the latest version?

```
pip install -U huggingface_hub
```<|||||>Upgrading both Transformer and huggingface_hub worked for me. <br>
```
pip install -U transformers
pip install -U huggingface_hub
```
<|||||>I am facing a similar issue, but it is not fixed by any of the above. Specifically, I am using this space: https://huggingface.co/spaces/ncoop57/cardify/tree/main

And it encounters the following runtime error:

```
/home/user/.local/lib/python3.8/site-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
Traceback (most recent call last):
  File "app.py", line 5, in <module>
    from autocards.autocards import Autocards
  File "/home/user/.local/lib/python3.8/site-packages/autocards/autocards.py", line 1, in <module>
    from autocards.pipelines import qg_pipeline
  File "/home/user/.local/lib/python3.8/site-packages/autocards/pipelines.py", line 10, in <module>
    from transformers import(
  File "/home/user/.local/lib/python3.8/site-packages/transformers/__init__.py", line 2709, in __getattr__
    return super().__getattr__(name)
  File "/home/user/.local/lib/python3.8/site-packages/transformers/file_utils.py", line 1822, in __getattr__
    value = getattr(module, name)
  File "/home/user/.local/lib/python3.8/site-packages/transformers/file_utils.py", line 1821, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "/home/user/.local/lib/python3.8/site-packages/transformers/models/auto/__init__.py", line 202, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/user/.local/lib/python3.8/site-packages/transformers/models/auto/modeling_auto.py", line 221, in <module>
    from ..rag.modeling_rag import (  # noqa: F401 - need to import all RagModels to be in globals() function
  File "/home/user/.local/lib/python3.8/site-packages/transformers/models/rag/modeling_rag.py", line 29, in <module>
    from .retrieval_rag import RagRetriever
  File "/home/user/.local/lib/python3.8/site-packages/transformers/models/rag/retrieval_rag.py", line 32, in <module>
    from datasets import Dataset, load_dataset, load_from_disk
  File "/home/user/.local/lib/python3.8/site-packages/datasets/__init__.py", line 37, in <module>
    from .arrow_dataset import Dataset, concatenate_datasets
  File "/home/user/.local/lib/python3.8/site-packages/datasets/arrow_dataset.py", line 61, in <module>
    from .arrow_writer import ArrowWriter, OptimizedTypedSequence
  File "/home/user/.local/lib/python3.8/site-packages/datasets/arrow_writer.py", line 26, in <module>
    from .features import Features, Image, Value
  File "/home/user/.local/lib/python3.8/site-packages/datasets/features/__init__.py", line 17, in <module>
    from .audio import Audio
  File "/home/user/.local/lib/python3.8/site-packages/datasets/features/audio.py", line 12, in <module>
    from ..utils.streaming_download_manager import xopen
  File "/home/user/.local/lib/python3.8/site-packages/datasets/utils/streaming_download_manager.py", line 19, in <module>
    from ..filesystems import COMPRESSION_FILESYSTEMS
  File "/home/user/.local/lib/python3.8/site-packages/datasets/filesystems/__init__.py", line 7, in <module>
    from .hffilesystem import HfFileSystem
  File "/home/user/.local/lib/python3.8/site-packages/datasets/filesystems/hffilesystem.py", line 6, in <module>
    from huggingface_hub.hf_api import DatasetInfo
ImportError: cannot import name 'DatasetInfo' from 'huggingface_hub.hf_api' (/home/user/.local/lib/python3.8/site-packages/huggingface_hub/hf_api.py)
```
I am using the following versions:

`huggingface_hub == 0.6.0` and `transformers == 4.19.1`

Any help would be greatly appreciated!

@LysandreJik <|||||>Fixed my issue by using `huggingface_hub == 0.5.0`<|||||>@LysandreJik I also need help right now..

I have also encountered the error "ImportError: cannot import name 'DatasetInfo' from 'huggingface_hub.hf_api'".
And no matter what versions of the transformers package and huggingface_hub package I have installed or updated to or degraded to, this error still exists...

After several rounds of uninstalling and reinstalling, the reported error altered from "ImportError: cannot import name 'DatasetInfo' from 'huggingface_hub.hf_api (C:\Users\Admin\anaconda3\lib\site-packages\huggingface_hub\hf_api.py)" to "ImportError: cannot import name 'model_info' from 'huggingface_hub' (C:\Users\Admin\anaconda3\lib\site-packages\huggingface_hub\__init__.py)"...
Below are the reported error information. I am now using transformers==4.20.1 and huggingface_hub==0.8.1

> ---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_28460/2252195315.py in <module>
      1 import torch
----> 2 from transformers import AutoTokenizer, AutoModelForSequenceClassification
      3 
      4 checkpoint = r"C:\Users\Admin\Desktop\nlp\bert-tiny"
      5 tokenizer = AutoTokenizer.from_pretrained(checkpoint)

~\anaconda3\lib\site-packages\transformers\__init__.py in __getattr__(self, name)
   2939         Wav2Vec2Config,
   2940         Wav2Vec2CTCTokenizer,
-> 2941         Wav2Vec2FeatureExtractor,
   2942         Wav2Vec2Processor,
   2943         Wav2Vec2Tokenizer,

~\anaconda3\lib\site-packages\transformers\file_utils.py in __getattr__(self, name)

~\anaconda3\lib\site-packages\transformers\file_utils.py in __getattr__(self, name)

~\anaconda3\lib\site-packages\transformers\models\auto\__init__.py in _get_module(self, module_name)
    208             MODEL_MAPPING,
    209             MODEL_WITH_LM_HEAD_MAPPING,
--> 210             AutoModel,
    211             AutoModelForAudioClassification,
    212             AutoModelForAudioFrameClassification,

~\anaconda3\lib\importlib\__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

~\anaconda3\lib\site-packages\transformers\models\auto\modeling_auto.py in <module>
     19 
     20 from ...utils import logging
---> 21 from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update
     22 from .configuration_auto import CONFIG_MAPPING_NAMES
     23 

~\anaconda3\lib\site-packages\transformers\models\auto\auto_factory.py in <module>
     18 
     19 from ...configuration_utils import PretrainedConfig
---> 20 from ...dynamic_module_utils import get_class_from_dynamic_module
     21 from ...utils import copy_func, logging
     22 from .configuration_auto import AutoConfig, model_type_to_module_name, replace_list_option_in_docstrings

~\anaconda3\lib\site-packages\transformers\dynamic_module_utils.py in <module>
     23 from typing import Dict, Optional, Union
     24 
---> 25 from huggingface_hub import HfFolder, model_info
     26 
     27 from .utils import (

ImportError: cannot import name 'model_info' from 'huggingface_hub' (C:\Users\Admin\anaconda3\lib\site-packages\huggingface_hub\__init__.py)