Failed to import transformer.
Labels: high priority, triage review, oncall: binaries, module: windows

### 🐛 Describe the bug

!pip install datasets evaluate transformers[sentencepiece]

```python
from transformers import Trainer

trainer = Trainer(
    model,
    training_args,
    train_dataset=tokenized_datasets["train"],
    eval_dataset=tokenized_datasets["validation"],
    data_collator=data_collator,
    tokenizer=tokenizer,
)
```

I am doing the NLP course by Hugging Face. On week 3, I cant seem the import anything from transformers.

```
{
	"name": "RuntimeError",
	"message": "Failed to import transformers.training_args because of the following error (look up to see its traceback):
[WinError 182] The operating system cannot run %1. Error loading \"d:\\Programmes\\anaconda3\\envs\\NLP310\\lib\\site-packages\\torch\\lib\\fbgemm.dll\" or one of its dependencies.",
	"stack": "---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
File ~\\AppData\\Roaming\\Python\\Python310\\site-packages\\transformers\\utils\\import_utils.py:1282, in _LazyModule._get_module(self, module_name)
   1281 try:
-> 1282     return importlib.import_module(\".\" + module_name, self.__name__)
   1283 except Exception as e:

File d:\\Programmes\\anaconda3\\envs\\NLP310\\lib\\importlib\\__init__.py:126, in import_module(name, package)
    125         level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)

File <frozen importlib._bootstrap>:1050, in _gcd_import(name, package, level)

File <frozen importlib._bootstrap>:1027, in _find_and_load(name, import_)

File <frozen importlib._bootstrap>:1006, in _find_and_load_unlocked(name, import_)

File <frozen importlib._bootstrap>:688, in _load_unlocked(spec)

File <frozen importlib._bootstrap_external>:883, in exec_module(self, module)

File <frozen importlib._bootstrap>:241, in _call_with_frames_removed(f, *args, **kwds)

File ~\\AppData\\Roaming\\Python\\Python310\\site-packages\\transformers\\training_args.py:30
     28 from packaging import version
---> 30 from .debug_utils import DebugOption
     31 from .trainer_utils import (
     32     EvaluationStrategy,
     33     FSDPOption,
   (...)
     37     ShardedDDPOption,
     38 )

File ~\\AppData\\Roaming\\Python\\Python310\\site-packages\\transformers\\debug_utils.py:21
     20 if is_torch_available():
---> 21     import torch
     24 logger = logging.get_logger(__name__)

File d:\\Programmes\\anaconda3\\envs\\NLP310\\lib\\site-packages\\torch\\__init__.py:128
    127     err.strerror += f' Error loading \"{dll}\" or one of its dependencies.'
--> 128     raise err
    129 elif res is not None:

OSError: [WinError 182] The operating system cannot run %1. Error loading \"d:\\Programmes\\anaconda3\\envs\\NLP310\\lib\\site-packages\\torch\\lib\\fbgemm.dll\" or one of its dependencies.

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
d:\\OneDrive\\Data\\Learning\\Natural Science\\Computer Science\\AI, ML, DL\\Hugging Face NLP\
otebooks-main\\course\\en\\chapter3\\section3.ipynb Cell 5 line 1
----> <a href='vscode-notebook-cell:/d%3A/OneDrive/Data/Learning/Natural%20Science/Computer%20Science/AI%2C%20ML%2C%20DL/Hugging%20Face%20NLP/notebooks-main/course/en/chapter3/section3.ipynb#W4sZmlsZQ%3D%3D?line=0'>1</a> from transformers import TrainingArguments
      <a href='vscode-notebook-cell:/d%3A/OneDrive/Data/Learning/Natural%20Science/Computer%20Science/AI%2C%20ML%2C%20DL/Hugging%20Face%20NLP/notebooks-main/course/en/chapter3/section3.ipynb#W4sZmlsZQ%3D%3D?line=2'>3</a> training_args = TrainingArguments(\"test-trainer\")

File <frozen importlib._bootstrap>:1075, in _handle_fromlist(module, fromlist, import_, recursive)

File ~\\AppData\\Roaming\\Python\\Python310\\site-packages\\transformers\\utils\\import_utils.py:1272, in _LazyModule.__getattr__(self, name)
   1270     value = self._get_module(name)
   1271 elif name in self._class_to_module.keys():
-> 1272     module = self._get_module(self._class_to_module[name])
   1273     value = getattr(module, name)
   1274 else:

File ~\\AppData\\Roaming\\Python\\Python310\\site-packages\\transformers\\utils\\import_utils.py:1284, in _LazyModule._get_module(self, module_name)
   1282     return importlib.import_module(\".\" + module_name, self.__name__)
   1283 except Exception as e:
-> 1284     raise RuntimeError(
   1285         f\"Failed to import {self.__name__}.{module_name} because of the following error (look up to see its\"
   1286         f\" traceback):\
{e}\"
   1287     ) from e

RuntimeError: Failed to import transformers.training_args because of the following error (look up to see its traceback):
[WinError 182] The operating system cannot run %1. Error loading \"d:\\Programmes\\anaconda3\\envs\\NLP310\\lib\\site-packages\\torch\\lib\\fbgemm.dll\" or one of its dependencies."
}
```

### Versions

(NLP310) D:\OneDrive\Data\Learning\Natural Science\Computer Science\AI, ML, DL\Hugging Face NLP\notebooks-main\course\en\chapter3>python collect_env.py
Collecting environment information...
PyTorch version: 2.1.0+cpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 10 Pro
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Libc version: N/A

Python version: 3.10.13 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:15:57) [MSC v.1916 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.19045-SP0
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture=9
CurrentClockSpeed=3801
DeviceID=CPU0
Family=107
L2CacheSize=4096
L2CacheSpeed=
Manufacturer=AuthenticAMD
MaxClockSpeed=3801
Name=AMD Ryzen 7 5700G with Radeon Graphics
ProcessorType=3
Revision=20480

Versions of relevant libraries:
[pip3] numpy==1.26.0
[pip3] torch==2.1.0
[conda] _tflow_select             2.3.0                       mkl
[conda] blas                      1.0                         mkl
[conda] mkl                       2023.1.0         h6b88ed4_46357
[conda] mkl-service               2.4.0           py310h2bbff1b_1
[conda] mkl_fft                   1.3.8           py310h2bbff1b_0
[conda] mkl_random                1.2.4           py310h59b6b97_0
[conda] numpy                     1.26.0          py310h055cbcc_0
[conda] numpy-base                1.26.0          py310h65a83cf_0
[conda] tensorflow                2.10.0          mkl_py310hd99672f_0
[conda] tensorflow-base           2.10.0          mkl_py310h6a7f48e_0
[conda] torch                     2.1.0                    pypi_0    pypi

(NLP310) D:\OneDrive\Data\Learning\Natural Science\Computer Science\AI, ML, DL\Hugging Face NLP\notebooks-main\course\en\chapter3>

cc @ezyang @gchanan @zou3519 @kadeng @seemethere @malfet @osalpekar @atalman @peterjc123 @mszhanyi @skyline75489 @nbcsm @vladimir-aubrecht @iremyux @Blackhex @cristianPanaite