인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

인프런 커뮤니티 질문&답변

안녕AI님의 프로필 이미지

작성한 질문수

프로젝트로 배우는 Python 챗봇 & RAG - LangChain, Gradio 활용

Huggingface Space에 웹앱 배포하기 (실습)

[질문드립니다] poetry export -f requirements.txt --output requirements.txt

작성

·

54

0

선생님께서 알려주신대로 txt 파일 뽑은 후(해시가 담겨있는) requirements.txt 업로드 시 서버에서 아래와 같은 에러가 났었습니다. 혹시 몰라서 pip freeze > requirements.txt로 생성한 뒤 업로드 해보니 제대로 실행이 되더라고요...! 이게 왜 그런걸까요? 선생님께서는 현재도 poetry export -f requirements.txt --output requirements.txt 로 만든 후 업로드 해도 실행이 잘 되시는 걸까요?

'에러':
===== Application Startup at 2025-01-09 14:21:54 ===== Traceback (most recent call last): File "/home/user/app/app.py", line 2, in <module> from dotenv import load_dotenv ModuleNotFoundError: No module named 'dotenv'

QnA 정리:

  • poetry export -f requirements.txt --output requirements.txt 한 후에 업로드 했더니 서버에서 모듈을 다운로드 하지 못함

  • pip freeze > requirements.txt 로 한 후에 업로드 했더니 서버에서 모듈을 정상적으로 다운로드 하고 app.py를 실행함

답변 1

1

판다스 스튜디오님의 프로필 이미지
판다스 스튜디오
지식공유자

안녕하세요. 판다스 스튜디오입니다.

아래와 같이 Poetry와 pip freeze의 requirements.txt 생성 방식에 차이가 있습니다.

# Poetry export 결과 예시

python-dotenv==1.0.0; python_version >= "3.8"

# pip freeze 결과 예시

python-dotenv==1.0.0

 

해결을 위해서 아래와 같이 Poetry export 시 제약조건을 제외하면 좋을 것 같습니다.

poetry export -f requirements.txt --without-hashes --without-urls --output requirements.txt

 

추가로 궁금하신 점이 있으시다면 편하게 댓글 남겨주사요. 감사합니다!

안녕AI님의 프로필 이미지

작성한 질문수

질문하기