• 카테고리

    질문 & 답변
  • 세부 분야

    AI · ChatGPT 활용

  • 해결 여부

    미해결

ch09의 '01_yt_extract_summerize_exp.ipynb' 실습중 에러

24.03.19 23:42 작성 24.03.19 23:43 수정 조회수 87

0

안녕하세요

 

ch09의 '01_yt_extract_summerize_exp.ipynb' 실습중에 마지막 'googletrans' 설치 및 실행시 오류가 발생합니다.

 

openai 랑 googletrans 에서 사용하는 라이브러리가 충돌나는거 같은데 해결방법 있을까요?

 

  • googletrans 설치시

pip install googletrans==3.1.0a0

Collecting googletrans==3.1.0a0
  Using cached googletrans-3.1.0a0-py3-none-any.whl
Collecting httpx==0.13.3 (from googletrans==3.1.0a0)
  Using cached httpx-0.13.3-py3-none-any.whl.metadata (25 kB)
Requirement already satisfied: certifi in e:\python\inflearn_chatgpt-main\ch09\ch09_env\lib\site-packages (from httpx==0.13.3->googletrans==3.1.0a0) (2024.2.2)
Collecting hstspreload (from httpx==0.13.3->googletrans==3.1.0a0)
  Using cached hstspreload-2024.3.1-py3-none-any.whl.metadata (2.1 kB)
Requirement already satisfied: sniffio in e:\python\inflearn_chatgpt-main\ch09\ch09_env\lib\site-packages (from httpx==0.13.3->googletrans==3.1.0a0) (1.3.1)
Collecting chardet==3.* (from httpx==0.13.3->googletrans==3.1.0a0)
  Using cached chardet-3.0.4-py2.py3-none-any.whl.metadata (3.2 kB)
Collecting idna==2.* (from httpx==0.13.3->googletrans==3.1.0a0)
  Using cached idna-2.10-py2.py3-none-any.whl.metadata (9.1 kB)
Collecting rfc3986<2,>=1.3 (from httpx==0.13.3->googletrans==3.1.0a0)
  Using cached rfc3986-1.5.0-py2.py3-none-any.whl.metadata (6.5 kB)
Collecting httpcore==0.9.* (from httpx==0.13.3->googletrans==3.1.0a0)
  Using cached httpcore-0.9.1-py3-none-any.whl.metadata (4.6 kB)
Collecting h11<0.10,>=0.8 (from httpcore==0.9.*->httpx==0.13.3->googletrans==3.1.0a0)
  Using cached h11-0.9.0-py2.py3-none-any.whl.metadata (8.1 kB)
Collecting h2==3.* (from httpcore==0.9.*->httpx==0.13.3->googletrans==3.1.0a0)
  Using cached h2-3.2.0-py2.py3-none-any.whl.metadata (32 kB)
Collecting hyperframe<6,>=5.2.0 (from h2==3.*->httpcore==0.9.*->httpx==0.13.3->googletrans==3.1.0a0)
  Using cached hyperframe-5.2.0-py2.py3-none-any.whl.metadata (7.2 kB)
Collecting hpack<4,>=3.0 (from h2==3.*->httpcore==0.9.*->httpx==0.13.3->googletrans==3.1.0a0)
  Using cached hpack-3.0.0-py2.py3-none-any.whl.metadata (7.0 kB)
Using cached httpx-0.13.3-py3-none-any.whl (55 kB)
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Using cached httpcore-0.9.1-py3-none-any.whl (42 kB)
Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Using cached h2-3.2.0-py2.py3-none-any.whl (65 kB)
Using cached rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)
Using cached hstspreload-2024.3.1-py3-none-any.whl (1.1 MB)
Using cached h11-0.9.0-py2.py3-none-any.whl (53 kB)
Using cached hpack-3.0.0-py2.py3-none-any.whl (38 kB)
Using cached hyperframe-5.2.0-py2.py3-none-any.whl (12 kB)
Installing collected packages: rfc3986, hyperframe, hpack, h11, chardet, idna, hstspreload, h2, httpcore, httpx, googletrans
  Attempting uninstall: h11
    Found existing installation: h11 0.14.0
    Uninstalling h11-0.14.0:
      Successfully uninstalled h11-0.14.0
  Attempting uninstall: idna
    Found existing installation: idna 3.6
    Uninstalling idna-3.6:
      Successfully uninstalled idna-3.6
  Attempting uninstall: httpcore
    Found existing installation: httpcore 1.0.4
    Uninstalling httpcore-1.0.4:
      Successfully uninstalled httpcore-1.0.4
  Attempting uninstall: httpx
    Found existing installation: httpx 0.27.0
    Uninstalling httpx-0.27.0:
      Successfully uninstalled httpx-0.27.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
openai 1.14.1 requires httpx<1,>=0.23.0, but you have httpx 0.13.3 which is incompatible.
Successfully installed chardet-3.0.4 googletrans-3.1.0a0 h11-0.9.0 h2-3.2.0 hpack-3.0.0 hstspreload-2024.3.1 httpcore-0.9.1 httpx-0.13.3 hyperframe-5.2.0 idna-2.10 rfc3986-1.5.0

 

  • 설치오류 무시하고 google_trans() 실행시

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[14], line 1
----> 1 from googletrans import Translator
      3 def google_trans(messages):
      4     google = Translator()

File e:\Python\inflearn_chatGPT-main\ch09\ch09_env\Lib\site-packages\googletrans\__init__.py:6
      2 __all__ = 'Translator',
      3 __version__ = '3.1.0-alpha'
----> 6 from googletrans.client import Translator
      7 from googletrans.constants import LANGCODES, LANGUAGES  # noqa

File e:\Python\inflearn_chatGPT-main\ch09\ch09_env\Lib\site-packages\googletrans\client.py:27
     22 from googletrans.models import Translated, Detected
     24 EXCLUDES = ('en', 'ca', 'fr')
---> 27 class Translator:
     28     """Google Translate ajax API implementation class
     29 
     30     You have to create an instance of Translator to use this API
   (...)
     52     :type raise_exception: boolean
     53     """
     55     def __init__(self, service_urls=DEFAULT_CLIENT_SERVICE_URLS, user_agent=DEFAULT_USER_AGENT,
     56                  raise_exception=DEFAULT_RAISE_EXCEPTION,
...
     59                  http2=True):
     61         self.client = httpx.Client(http2=http2)
     62         if proxies is not None:  # pragma: nocover

AttributeError: module 'httpcore' has no attribute 'SyncHTTPTransport'
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

 

답변 1

답변을 작성해보세요.

0

인프런 AI 인턴님의 프로필

인프런 AI 인턴

2024.03.19

안녕하세요, 인프런 AI 인턴입니다.

doRemiPa님, 질문하신 내용에 대해 유사한 문제를 겪었던 다른 사용자의 사례를 찾아 테스트해본 결과를 공유드리겠습니다. doRemiPa님의 문제는 googletrans 패키지와 openai 패키지 간의 의존성 충돌로 인해 버전 호환성 문제가 발생한 것으로 보입니다. 이러한 종류의 오류는 일반적으로 특정 버전의 패키지들이 서로 호환되지 않을 때 발생합니다.

해당 문제와 관련하여 유사한 케이스의 해결 방법을 제시하는 여러 링크들이 있었고, 이 중 하나를 다음과 같이 공유드립니다.

ch07 실습에 필요한 패키지 설치 시 오류가 납니다.

  • 이 링크에서는 openaigoogletrans 패키지 버전 호환성 문제와 비슷한 상황에 대해 다루고 있습니다. 답변에 따르면, 강의에서 사용하는 openai 패키지의 구버전을 설치하는 것이 해결 방법 중 하나로 제시되었습니다.

doRemiPa님의 경우에는 openai 패키지와 httpx 패키지가 googletrans 설치 시 의존성 충돌을 일으켜 발생한 문제로 보입니다. 답변에서 제시한 방법을 참고하여 doRemiPa님의 환경에 맞춰 호환되는 패키지 버전을 설치하시면 문제가 해결될 수 있습니다.

저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.
현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏
추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.

doRemiPa님의 프로필

doRemiPa

질문자

2024.03.20

네 답변감사합니다.

다른 게시글(https://www.inflearn.com/questions/1077919) 에서 openai 패키지 신규버전을 적용했다고 하셔서 최신버전으로 테스트 했습니다.

openai 구버전으로 확인해 볼게요.

감사합니다.