Unable to import Hugging Face transformers

I have been using transformers fine up until today. However, when I imported the package today, I received this error message:

In Transformers v4.0.0, the default path to cache downloaded models changed from '~/.cache/torch/transformers' to '~/.cache/huggingface/transformers'. Since you don't seem to have overridden and '~/.cache/torch/transformers' is a directory that exists, we're moving it to '~/.cache/huggingface/transformers' to avoid redownloading models you have already in the cache. You should only see this message once.

Error: Destination path '/home/user/.cache/huggingface/transformers/transformers' already exists

I have tried to install and uninstall the package but still unable to make it work.

Any suggestions to fix this would be really appreciated.

It seems you already have /home/user/.cache/huggingface/transformers/transformers, and transformers v4 tried to make ~/.cache/huggingface/transformers and failed.
How about mv (rename) the /home/user/.cache/huggingface/transformers/ to some temporary name and retry import transformers? (If I were you, I would not delete the directory, but rename it and keep it for now, just in case.)

2 Likes

This is also fixed in the latest version.

2 Likes