작성
·
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
추가로 궁금하신 점이 있으시다면 편하게 댓글 남겨주사요. 감사합니다!