I experienced the same import error when running the following script from the hugging face transformer quick tour. Installing the 2 mentioned libraries did not resolve.
from transformers import TrainingArguments
training_args = TrainingArguments(
output_dir=“./pt_training”,
learning_rate=2e-5,
per_device_train_batch_size=8,
per_device_eval_batch_size=8,
num_train_epochs=2,
)