symbol not found in flat namespace '__ZNSt8ios_base4InitC1Ev'
Author: ryanrudes
Pull request: no
Labels: name: bug

### System Info

**OS**: macOS Monterey Version 12.4 Beta
**Model**: MacBook Air (M1, 2020)
**Chip**: Apple M1
**Memory**: 8GB

```shell
Python 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:24:38)
[Clang 12.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import transformers, flax, tensorflow, torch
/Users/ryanrudes/miniforge3/lib/python3.9/site-packages/jax/_src/lib/__init__.py:33: UserWarning: JAX on Mac ARM machines is experimental and minimally tested. Please see https://github.com/google/jax/issues/5501 in the event of problems.
  warnings.warn("JAX on Mac ARM machines is experimental and minimally tested. "
>>> transformers.__version__
'4.18.0'
>>> flax.__version__
'0.4.1'
>>> tensorflow.__version__
'2.8.0'
>>> torch.__version__
'1.10.1'
```


### Who can help?

@patil-suraj

### 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

Importing anything from the library results in a "symbol not found" error. I am sure this issue has something to do with the Apple Silicon architecture.

Here's the stack trace:
```shell
>>> from transformers import *
Traceback (most recent call last):
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 857, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/Users/ryanrudes/miniforge3/envs/.../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 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/tokenization_utils.py", line 26, in <module>
    from .tokenization_utils_base import (
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 72, in <module>
    from tokenizers import AddedToken
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/tokenizers/__init__.py", line 79, in <module>
    from .tokenizers import (
ImportError: dlopen(/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/tokenizers/tokenizers.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '__ZNSt8ios_base4InitC1Ev'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 857, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/Users/ryanrudes/miniforge3/envs/.../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 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/convert_graph_to_onnx.py", line 23, in <module>
    from transformers.pipelines import Pipeline, pipeline
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/pipelines/__init__.py", line 28, in <module>
    from ..models.auto.configuration_auto import AutoConfig
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/models/__init__.py", line 19, in <module>
    from . import (
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/models/layoutlm/__init__.py", line 22, in <module>
    from .configuration_layoutlm import LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP, LayoutLMConfig
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/models/layoutlm/configuration_layoutlm.py", line 19, in <module>
    from transformers import PretrainedConfig, PreTrainedTokenizer, TensorType
  File "<frozen importlib._bootstrap>", line 1039, in _handle_fromlist
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 847, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 859, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import transformers.tokenization_utils because of the following error (look up to see its traceback):
dlopen(/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/tokenizers/tokenizers.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '__ZNSt8ios_base4InitC1Ev'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1037, in _handle_fromlist
  File "<frozen importlib._bootstrap>", line 1039, in _handle_fromlist
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 845, in __getattr__
    value = self._get_module(name)
  File "/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 859, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import transformers.convert_graph_to_onnx because of the following error (look up to see its traceback):
Failed to import transformers.tokenization_utils because of the following error (look up to see its traceback):
dlopen(/Users/ryanrudes/Downloads/.../venv/lib/python3.8/site-packages/tokenizers/tokenizers.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '__ZNSt8ios_base4InitC1Ev'
```

Same issue when importing tokenizers:

```shell
Python 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:24:38)
[Clang 12.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tokenizers import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ryanrudes/miniforge3/lib/python3.9/site-packages/tokenizers/__init__.py", line 79, in <module>
    from .tokenizers import (
ImportError: dlopen(/Users/ryanrudes/miniforge3/lib/python3.9/site-packages/tokenizers/tokenizers.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '__ZNSt8ios_base4InitC1Ev'
```

### Expected behavior

Obviously, the library is supposed to import without any errors.


Comments:
Uninstalling a couple dependencies including the transformers package itself, and then installing everything within conda solved my problem. Specifically for anyone with the same problem:

```shell
pip uninstall torch tokenizers transformers
conda install pytorch
conda install -c huggingface transformers
```