Module image_processing_videomae can't be found
Author: TheOrange-cmd
Pull request: no

### System Info


- `transformers` version: 4.22.0
- Platform: Windows-10-10.0.19041-SP0
- Python version: 3.8.5
- Huggingface_hub version: 0.14.1
- PyTorch version (GPU?): 1.12.1 (False)
- Tensorflow version (GPU?): 2.10.0 (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No



### Who can help?

When following the tutorial for the TimeSFormer, I run into an issue importing the relevant modules. This is the tutorial:
https://huggingface.co/docs/transformers/main/tasks/video_classification

### Information

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

### Tasks

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

### Reproduction

```
from transformers import VideoMAEImageProcessor, VideoMAEForVideoClassification

model_ckpt = "MCG-NJU/videomae-base"
image_processor = VideoMAEImageProcessor.from_pretrained(model_ckpt)
model = VideoMAEForVideoClassification.from_pretrained(
    model_ckpt,
    label2id=label2id,
    id2label=id2label,
    ignore_mismatched_sizes=True,  # provide this in case you're planning to fine-tune an already fine-tuned checkpoint
)
```

The error:
```


ImportError                               Traceback (most recent call last)
[d:\Fall_Detection\BAP_fall_detection\.conda\lib\site-packages\transformers\utils\import_utils.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/site-packages/transformers/utils/import_utils.py) in _get_module(self, module_name)
   1171         try:
-> 1172             return importlib.import_module("." + module_name, self.__name__)
   1173         except Exception as e:

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\importlib\__init__.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/importlib/__init__.py) in import_module(name, package)
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\importlib\_bootstrap.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/importlib/_bootstrap.py) in _gcd_import(name, package, level)

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\importlib\_bootstrap.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/importlib/_bootstrap.py) in _find_and_load(name, import_)

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\importlib\_bootstrap.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/importlib/_bootstrap.py) in _find_and_load_unlocked(name, import_)

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\importlib\_bootstrap.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/importlib/_bootstrap.py) in _load_unlocked(spec)

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\importlib\_bootstrap_external.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/importlib/_bootstrap_external.py) in exec_module(self, module)

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\importlib\_bootstrap.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/importlib/_bootstrap.py) in _call_with_frames_removed(f, *args, **kwds)

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\site-packages\transformers\models\videomae\image_processing_videomae.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/site-packages/transformers/models/videomae/image_processing_videomae.py) in 
     21 from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
---> 22 from ...image_transforms import (
     23     center_crop,

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\site-packages\transformers\image_transforms.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/site-packages/transformers/image_transforms.py) in 
     20 
---> 21 from .image_utils import (
     22     ChannelDimension,

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\site-packages\transformers\image_utils.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/site-packages/transformers/image_utils.py) in 
     43 if is_vision_available():
---> 44     import PIL.Image
     45     import PIL.ImageOps

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\site-packages\PIL\Image.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/site-packages/PIL/Image.py) in 
     99     # and should be considered private and subject to change.
--> 100     from . import _imaging as core
    101 

ImportError: DLL load failed: The specified module could not be found.

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
[~\AppData\Local\Temp\ipykernel_10824\1632751044.py](https://file+.vscode-resource.vscode-cdn.net/d%3A/Fall_Detection/BAP_fall_detection/~/AppData/Local/Temp/ipykernel_10824/1632751044.py) in 
----> 1 from transformers import VideoMAEImageProcessor, VideoMAEForVideoClassification
      2 
      3 model_ckpt = "MCG-NJU/videomae-base"
      4 image_processor = VideoMAEImageProcessor.from_pretrained(model_ckpt)
      5 model = VideoMAEForVideoClassification.from_pretrained(

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\importlib\_bootstrap.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/importlib/_bootstrap.py) in _handle_fromlist(module, fromlist, import_, recursive)

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\site-packages\transformers\utils\import_utils.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/site-packages/transformers/utils/import_utils.py) in __getattr__(self, name)
   1161         elif name in self._class_to_module.keys():
   1162             module = self._get_module(self._class_to_module[name])
-> 1163             value = getattr(module, name)
   1164         else:
   1165             raise AttributeError(f"module {self.__name__} has no attribute {name}")

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\site-packages\transformers\utils\import_utils.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/site-packages/transformers/utils/import_utils.py) in __getattr__(self, name)
   1160             value = self._get_module(name)
   1161         elif name in self._class_to_module.keys():
-> 1162             module = self._get_module(self._class_to_module[name])
   1163             value = getattr(module, name)
   1164         else:

[d:\Fall_Detection\BAP_fall_detection\.conda\lib\site-packages\transformers\utils\import_utils.py](file:///D:/Fall_Detection/BAP_fall_detection/.conda/lib/site-packages/transformers/utils/import_utils.py) in _get_module(self, module_name)
   1175                 f"Failed to import {self.__name__}.{module_name} because of the following error (look up to see its"
   1176                 f" traceback):\n{e}"
-> 1177             ) from e
   1178 
   1179     def __reduce__(self):

RuntimeError: Failed to import transformers.models.videomae.image_processing_videomae because of the following error (look up to see its traceback):
DLL load failed: The specified module could not be found.

```

When I run transformers-cli env:

```
WARNING:tensorflow:From D:\Program Files\Anaconda\lib\site-packages\transformers\commands\env.py:52: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2023-05-19 10:53:04.292349: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
```

And the version list I gave above. 

### Expected behavior

According to the tutorial, the output should be:

Some weights of the model checkpoint at MCG-NJU/videomae-base were not used when initializing VideoMAEForVideoClassification: [..., 'decoder.decoder_layers.1.attention.output.dense.bias', 'decoder.decoder_layers.2.attention.attention.key.weight']
- This IS expected if you are initializing VideoMAEForVideoClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing VideoMAEForVideoClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Some weights of VideoMAEForVideoClassification were not initialized from the model checkpoint at MCG-NJU/videomae-base and are newly initialized: ['classifier.bias', 'classifier.weight']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.

Comments:
Hi @TheOrange-cmd, thanks for reporting this issue. 

Is seems the error is arising with an import of the PIL library. Could you run `pip list | grep Pillow` and share which version of `Pillow` is installed? 

Thank you for the quick response. I get some errors with grep; I see it's meant for Linux? I tried installing it but it still doesn't work. If I just run pip list or pip freeze or conda list Pillow I get version 9.4.0 for each command. Conda specifies I have build py38hd77b12b_0. 

Hi @TheOrange-cmd, 

Yes, sorry, `grep` is a linux command - sometimes I'm so used to writing it out I forget to check about the OS. 

Thanks for giving the Pillow version info. It's the same version as I'm running locally, so 9.4.0 should work. Could you try upgrading the running version of `transformers` to the most recent release - 4.29.2? 

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.

I had this same problem, with the most recent version of ```transformers```.  I solved it by starting a new environment.