zhanghang1989 / PyTorch-Encoding

A CV toolkit for my papers.
https://hangzhang.org/PyTorch-Encoding/
MIT License
2.04k stars 450 forks source link

ImportError: cannot import name 'cpu' from partially initialized module 'encoding' (most likely due to a circular import) #424

Closed Coobiw closed 1 year ago

Coobiw commented 1 year ago

ImportError: cannot import name 'cpu' from partially initialized module 'encoding' (most likely due to a circular import)

torch.version '2.0.0+cu117'

torch.version.cuda '11.7'

Actually, before I install pytorch-encoding, I install torch=1.9.1+cu111 torchvison=0.10.1+cu111

after install pytorch-encoding, it changed.

Coobiw commented 1 year ago

Sorry,the version change is because I install pytorch-lightning. Now I have turn back to torch=1.9.1+cu111 torchvison=0.10.1+cu111. Unfortunately, after

pip uninstall torch-encoding

I run :

python setup.py install

and get an error:

RuntimeError: Error compiling objects for extension

Thanks for your sincere answer.

Coobiw commented 1 year ago

I solve this problem by pip, just run:

pip install torch-encoding.

Really embarrassing.