pytest throws ImportError: cannot import name 'json' from 'itsdangerous'
Author: gchhablani
Pull request: no

Running any test using pytest throws the following `ImportError`:

```python
Traceback (most recent call last):
  File "/home/crocoder/anaconda3/envs/transformers_env/bin/pytest", line 8, in <module>
    sys.exit(console_main())
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 187, in console_main
    code = main()
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 145, in main
    config = _prepareconfig(args, plugins)
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 324, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/_pytest/helpconfig.py", line 102, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1016, in pytest_cmdline_parse
    self.parse(args)
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1304, in parse
    self._preparse(args, addopts=addopts)
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1187, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/pluggy/_manager.py", line 287, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 168, in exec_module
    exec(co, module.__dict__)
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/dash/__init__.py", line 5, in <module>
    from .dash import Dash, no_update  # noqa: F401,E402
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 168, in exec_module
    exec(co, module.__dict__)
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/dash/dash.py", line 17, in <module>
    import flask
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/flask/__init__.py", line 19, in <module>
    from . import json
  File "/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/flask/json/__init__.py", line 15, in <module>
    from itsdangerous import json as _json
ImportError: cannot import name 'json' from 'itsdangerous' (/home/crocoder/anaconda3/envs/transformers_env/lib/python3.8/site-packages/itsdangerous/__init__.py)
```
### Env details
- conda: 4.10.3
- python: 3.8.13
- itsdangerous : 2.1.2
- Output of `pip list|grep pytest`:
  ```
  pytest                       7.1.1
  pytest-forked                1.4.0
  pytest-timeout               2.1.0
  pytest-xdist                 2.5.0
  ```

### Possible solutions
- Checked this [StackOverflow question](https://stackoverflow.com/questions/71189819/python-docker-importerror-cannot-import-name-json-from-itsdangerous). Seems like the issue is with my `pytest` version or `itsdangerous` version.

Comments:
Uninstalling `flask` and `itsdangerous` and re-installing the `".[dev]"` environment fixed the issue.

PR which fixes this issue:
https://github.com/huggingface/transformers/pull/16387