importError:Key already registered with the same priority

When I import torch, it shows:“Key already registered with the same priority: GroupSpatialSoftmax”, I don’t know what’s going on.

1 Like

How did you install PyTorch? Did you install the binaries or build form source?
Are you using the GroupSpatialSoftmax in a standalone module or just from pytorch/modules/detectron?

1 Like

I had the same problem.

I installed PyTorch following this command:
pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f

However, I noticed that my Python environment had a previous installation of PyTorch+CUDA which was later removed (uninstalled).

What I found is that the uninstalled task was not able to remove all the content (library files such as *.DLLs, etc.) from torch folder in the site-packages directory. I had to delete manually that folder. Aftewards, I installed again PyTorch (with the correct version for my environment: no CUDA), and it started to work fine.

Conclusion: This problem is due to existent library files in the torch folder due to previous installations. One needs to remove them manually before reinstall again the latest version of PyTorch.



Thanks for your advice! It really help!

Thank you for asking, but I can’t remember that. I reinstalled my environment after a disastrous breakdown and now It works well!

I got the same error using anaconda.
The solution for me was to create a new virtual environment and run:
%conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
to set up pytorch again.