# Importing TrainingArguments gives error

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fimporting-trainingarguments-gives-error%2F49808%3E%5C
**Category:** 🤗Transformers\
**Created:** [August 7, 2023, 11:18am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fimporting-trainingarguments-gives-error%2F49808 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftayyibsupercool)%5C
**Post date:** [August 7, 2023, 11:18am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fimporting-trainingarguments-gives-error%2F49808%2F1 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmuellerzr)%5C
**Post date:** [August 7, 2023, 1:11pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fimporting-trainingarguments-gives-error%2F49808%2F2 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftayyibsupercool)%5C
**Post date:** [August 7, 2023, 4:44pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fimporting-trainingarguments-gives-error%2F49808%2F3 "2023-08-07T16:44:07Z")

</div>

Yes, restarting worked for me, thanks 🙂
