1인개발 메이킹로그/[Infra+k8s+App] 가상화폐 자동매매
[AWS-Server] Troubleshooting - ModuleNotFoundError: No module named 'pyupbit'
청룡동사는연우
2023. 5. 20. 12:30
한 일주일 전부터 로그 파일이 비어있는 상황 발생
직접 서버에 들어가서 파일을 실행해봤을때
~/CICDpipeline-Pord-Autotrade-EC2-TradeServer$ sudo python3 ethereum_autotrade.py
Traceback (most recent call last):
File "/home/ubuntu/CICDpipeline-Pord-Autotrade-EC2-TradeServer/ethereum_autotrade.py", line 1, in <module>
import pyupbit
ModuleNotFoundError: No module named 'pyupbit'
라고 나오는 현상 확인
- apt, apt-get 업데이트 후 실행 시 동일 문구 반환
- pyupbit 모듈 삭제 후 재실치 시 동일 문구 반환
test 파일을 만들어서 실행해봤음
#test.py
import pyupbit
import aws_defs as m_aws
upbit_access_key, upbit_secret_key = m_aws.get_parameter_fromSSM()
bestk,endprice=m_aws.read_dynamoDB_table()
ticker='KRW-ETH'
print(pyupbit.get_orderbook(ticker=ticker)["orderbook_units"][0]["ask_price"])
# testing
~/CICDpipeline-Pord-Autotrade-EC2-TradeServer$ python3 test.py
2441000.0
정상 작동함
프로그램 코드에는 문제 없음
해결
해당 __pycache__ 파일 지우고 재실행했을때 정상 작동함