트러블슈팅

[트러블슈팅] langchain-google-genai 사용 중에 protoc >= 3.19.0 오류

ramin0119 2025. 6. 12. 12:48
728x90

1. 문제발생

윈도우 환경에서 LLM 관련 프로젝트를 새로운 가상환경을 만들어 세팅하던 중에 아래와 같은 오류가 발생했다.

 

TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

 

 

 

2. 원인 추론

단순히 읽어보니, protobuf라는 패키지를 3.20.x 또는 그 아래 버전으로 다운그레이드 해야함을 알았다.

 

3. 해결방안

 

해결 방법은 다음과 같다.

버전이 호환되지 않으니, protobuf 패키지 버전을 3.20.x 버전대로 낮춰야 한다는 오류이므로,

나는 protobuf를 3.20.3 버전으로 낮추었다.

pip install "protobuf==3.20.3"

 

해당 오류에 대한 URL: https://stackoverflow.com/questions/72441758/typeerror-descriptors-cannot-not-be-created-directly

 

 

4. 결과

이후 정상적으로 fastapi도 작동됨을 확인했다!

728x90