본문 바로가기

Error and Solve

[오류 해결] ModuleNotFoundError: No module named 'huggingface_hub.constants' / pip install transformers, hugginface-hub

반응형

 

 

오류 ModuleNotFoundError: No module named 'huggingface_hub.constants'

 

diffusers/utils/constants.py", line 17, in 
    from huggingface_hub.constants import HF_HOME
ModuleNotFoundError: No module named 'huggingface_hub.constants'

 

 

ModuleNotFoundError: No module named 'huggingface_hub.constants'

huggingface_hub 패키지에서 no module error가 났다 

 

 

 

 

transformers, hugginface-hub 패키지 재설치

 

먼저 transformer 버전을 수정했다 

 

pip install transformers==4.35.0

pip install transformers==4.35.0

 

이렇게만 설치하고 파일을 실행하면 

 

 

 

ImportError: cannot import name 'HF_HOME' from 'huggingface_hub.constants' (/../huggingface_hub/constants.py)

 

아까의 module not found랑 다르게 import error가 난다

 

HF_HOME huggingface_hub.constrants 에러가 나는데 

이때 다시 huggingface-hub를 재설치해주면 된다.

 

 

 

 

더 낮은 버전으로 downgrade를 진행했다

pip install huggingface-hub==0.21.2

pip install huggingface-hub==0.21.2

 

pip install transformers==4.35.0

pip install hugginface-hub==0.21.2

 

순차적으로 진행하면 해결할 수 있다

 

 


 

Reference

 

 

 

 

 

반응형