Cannot import Tool if old version of huggingface_hub is installed
Author: freddyaboulton
Pull request: no

### System Info

- `transformers` version: 4.29.0
- Platform: macOS-12.2.1-arm64-arm-64bit
- Python version: 3.9.16
- Huggingface_hub version: 0.13.4
- Safetensors version: not installed
- PyTorch version (GPU?): not installed (NA)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help?

@sgugger @LysandreJik 

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

1. Have huggingface_hub 0.13.4 installed
2. Import Tool class


```python
 from transformers import Tool
```

```
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File ~/miniconda3/envs/gradio-tools/lib/python3.9/site-packages/transformers/utils/import_utils.py:1172, in _LazyModule._get_module(self, module_name)
   1171 try:
-> 1172     return importlib.import_module("." + module_name, self.__name__)
   1173 except Exception as e:

File ~/miniconda3/envs/gradio-tools/lib/python3.9/importlib/__init__.py:127, in import_module(name, package)
    126         level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File <frozen importlib._bootstrap>:1030, in _gcd_import(name, package, level)

File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)

File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)

File <frozen importlib._bootstrap>:680, in _load_unlocked(spec)

File <frozen importlib._bootstrap_external>:850, in exec_module(self, module)

File <frozen importlib._bootstrap>:228, in _call_with_frames_removed(f, *args, **kwds)

File ~/miniconda3/envs/gradio-tools/lib/python3.9/site-packages/transformers/tools/base.py:27
     26 from huggingface_hub import CommitOperationAdd, HfFolder, create_commit, create_repo, hf_hub_download, metadata_update
---> 27 from huggingface_hub.utils import RepositoryNotFoundError, get_session
     29 from ..dynamic_module_utils import custom_object_save, get_class_from_dynamic_module, get_imports

ImportError: cannot import name 'get_session' from 'huggingface_hub.utils' (/Users/freddy/miniconda3/envs/gradio-tools/lib/python3.9/site-packages/huggingface_hub/utils/__init__.py)
```


### Expected behavior

Importing tool class does not raise an error. 

Upgrading to hugginggface_hub version 0.14.1 fixes the issue!

Comments:
Thanks for reporting! This will be addressed in #23301 

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

Hi I have the exact same error

from transformers import pipeline
  ...: 
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3437, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-7-69a9fd07ccac>", line 1, in <module>
    from transformers import pipeline
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/transformers/__init__.py", line 26, in <module>
    from . import dependency_versions_check
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/transformers/dependency_versions_check.py", line 16, in <module>
    from .utils.versions import require_version, require_version_core
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/transformers/utils/__init__.py", line 18, in <module>
    from huggingface_hub import get_full_repo_name  # for backward compatibility
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/huggingface_hub/__init__.py", line 370, in __getattr__
    submod = importlib.import_module(submod_path)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/huggingface_hub/hf_api.py", line 51, in <module>
    from ._commit_api import (
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/huggingface_hub/_commit_api.py", line 17, in <module>
    from huggingface_hub import get_session
ImportError: cannot import name 'get_session' from 'huggingface_hub' (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/huggingface_hub/__init__.py)

my  hugginggface_hub version is Version: 0.21.3
and transformers 4.38.1


Hi @Daa06, that's very odd - I'm not able to replicate this error with this hub or transformers version. 

Can you verify your versions running in your python session: 

```py
>>> import huggingface_hub
>>> import transformers
>>> print(huggingface_hub.__version__)
>>> print(transformers.__version__)
```

> Hi @Daa06, that's very odd - I'm not able to replicate this error with this hub or transformers version.
> 
> Can you verify your versions running in your python session:
> 
> ```python
> >>> import huggingface_hub
> >>> import transformers
> >>> print(huggingface_hub.__version__)
> >>> print(transformers.__version__)
> ```

Okay i tried in fact the line "import transformers" give me the same error as above. But I check and  it is installed
However the print(huggingface_hub.__version__) give me 0.20.3


@Daa06 I'd suggest trying to reinstall transformers in your environment: `pip install -U transformers`