# Importing TrainingArguments gives error

**URL:** <https://discuss.huggingface.co/t/importing-trainingarguments-gives-error/49808>\
**Category:** 🤗Transformers\
**Created:** [August 7, 2023, 11:18am UTC](https://discuss.huggingface.co/t/importing-trainingarguments-gives-error/49808 "2023-08-07T11:18:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tayyibsupercool](https://avatars.discourse-cdn.com/v4/letter/t/49beb7/32.png) [@tayyibsupercool](https://discuss.huggingface.co/u/tayyibsupercool)\
**Post date:** [August 7, 2023, 11:18am UTC](https://discuss.huggingface.co/t/importing-trainingarguments-gives-error/49808/1 "2023-08-07T11:18:56Z")

</div>

My code is:

> from transformers import TrainingArguments
> 
> training\_args = TrainingArguments(“test-trainer”)

I get error:  
ImportError: Using the `Trainer` with `PyTorch` requires `accelerate>=0.20.1`: Please run `pip install transformers[torch]` or `pip install accelerate -U`

I have installed both libraries, but I still get the same error.

---

<div class="post-metadata">

**Author:** ![muellerzr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/muellerzr/32/21583_2.png) [@muellerzr](https://discuss.huggingface.co/u/muellerzr)\
**Post date:** [August 7, 2023, 1:11pm UTC](https://discuss.huggingface.co/t/importing-trainingarguments-gives-error/49808/2 "2023-08-07T13:11:11Z")

</div>

> [@tayyibsupercool](#):
>
> I have installed both libraries, but I still get the same error.

Is `accelerate` \> 0.20.1? And if so, and if you are in colab, please ensure you do Runtime → Restart Runtime. This is a very common error 🙂

---

<div class="post-metadata">

**Author:** ![tayyibsupercool](https://avatars.discourse-cdn.com/v4/letter/t/49beb7/32.png) [@tayyibsupercool](https://discuss.huggingface.co/u/tayyibsupercool)\
**Post date:** [August 7, 2023, 4:44pm UTC](https://discuss.huggingface.co/t/importing-trainingarguments-gives-error/49808/3 "2023-08-07T16:44:07Z")

</div>

Yes, restarting worked for me, thanks 🙂
