How to install the gym (atari) on python 3.5 in Windows 10, 윈도우10에 gym 설치하기

in #gym7 years ago

I just followed all details from the slightly changed ALE at https://github.com/j8lp/atari-py

If you're not familiar with Korean please follow the instructions in the page

0. 주절주절

  • 우분투나 맥을 쓴다면 gym, 특히 atari를 python 환경에 설치하고 실행하는데 큰 어려움이 따르지 않는다

  • 하지만 대부분의 OS를 Windows로 사용하는 우리나라에선 아무래도 개개인들의 기술적, 비용적 한계가 따를 수 밖에 없는 것이 현실이지만...

  • 많은 사람들이 이야기하길 windows 에서 gym 설치를 시도해보는 바에는 우분투를 배우는게 빠르다고 할 정도..

  • 나 역시도 Tensorflow의 초창기 gpu 버전을 위해서 우분투를 배웠고 이래저래 잘 사용은 하고 있지만 역시나 Windows 에서 gym 사용에 대한 집착은 버릴 수 없었다

  • 이래저래 찾아본 결과 며칠 간의 삽질 끝에 결론은 성공이다-!

1. gym windows 설치 방법들의 문제점

  • 조금이라도 windows 를 설치해보기 위해서 알아보신 분들이라면
    https://github.com/rybskej/atari-py 이 깃헙을 한번이라도 봤을 것이며
    영문, 한글 설명 글 역시 이 안내를 잘 따라가고 있다
    하지만... 그것들을 따라해도 항상 안된다는 것이 문제...

    왜..? 하면서 찾아다니다 드디어 문제점을 포착하게 되는데..


    https://github.com/openai/atari-py/issues/5

    결론인 즉 그 repo 가 예전에는 잘 됐으나 atari 업데이트 되면서 지금은 쓰지 못한다는 것..

    친절한 분이 자기가 수정해서 commit 해놓은 repo 를 알려주는데 그것이 바로 https://github.com/j8lp/atari-py 이곳

2. 본격, Windows 10 (64bit) Python 3.5(64bit) 에 gym 설치

  • 다른 윈도우 환경에서도 될 확률이 높지만 일단 제가 한 환경을 명시했습니다!

  • Window 10(64bit), Python3.5(64bit with Anaconda)

(1) https://msys2.github.io/ 에서 msys64 설치 ( 32비트 환경이라면 32비트로!)

 MSYS 는 mingw terminal 실행하기 위한 패키지(?) 이며 
 mingw 는 리눅스용 프로그램을 윈도우에서 빌드할 수 있게 도와주는 뭐 그런... 내용이라고 합니다 

(2) 설치 후 설치페이지에 있는 post instruction을 잘 따라줍니다

 MSYS2 MSYS 를 실행시키고 터미널에 
 pacman -Syu
 실행시키기!
 필요하다면 MSYS2 MSYS 재 실행 후 
 pacman -Su
 를 터미널에 입력해주어서 나머지 database 와 core system을 업데이트 해줍니다!

(3) MSYS package 설치

 MSYS terminal 에서
 pacman -S base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake
 쳐서 실행시키기 (패키지 설치)

(4) msys 관련된 환경변수 설정해주기!

 환경변수 설정에 여러가지 방법이 있지만 윈도우키 누르시고 
 '환경 변수' 치고 나오는 '시스템 환경 변수 편집' 창 눌러줍니다
 하단의 '환경 변수' 클릭!,  '시스템 변수' 란에서 변수 'Path'를 찾아 더블클릭
 우측 상단 '새로만들기' 클릭
  C:\msys64\mingw64\bin
  엔터
 '새로만들기' 다시 클릭
 C:\msys64\usr\bin
 엔터, 끝

(5) Xming 설치

Xming 설치 페이지 : https://sourceforge.net/projects/xming
다운로드 후 설치

  환경변수 설정 : 윈도우키 > '시스템 환경 변수 설정' 검색 실행 > '환경 변수' 클릭 > 
 '시스템 변수' 란의 '새로 만들기(W)' 클릭
 변수명
 DISPLAY
 값
 :0
 확인

(6) Git 설치

깃 다운로드 홈페이지 : https://git-scm.com/download/win
버전에 맞게 설치 (기존에 있으면 패스)

(7) python terminal 실행

 기존 사용하던 terminal 있으면 그대로 실행

 없으면, https://www.anaconda.com/download/ 에서 python 3.x 64bit 설치 (32비트 사용자는 32비트로)

 시작 > Anaconda Prompt (검색 혹은 Anaconda 항목에서 실행) 실행
 
 Terminal 에 
 conda create -n py35 python=3.5
 명령으로 가상환경 설치 후
 activate py35
 명령으로 가상환경에 들어갑니다!

  terminal의 기본 path는 C:\Users\username\Documents 일 것인데 여기에 바로 설치해도 되지만 가급적

 cd ..  명령을 3번 쳐서 path 를 C: 로 하면 초보자에게 도움이 됩니다

 설치하고 싶은 path 설정 후 

 git clone https://github.com/j8lp/atari-py

 명령으로 git repository 에서 clone 해 온 다음

 cd atari-py && make && python setup.py install && pip install "gym[atari]"

 명령 치면 4가지 명령이 순차적으로 들어갑니다 그리고는 대망의 gym 을 설치하게 됩니다

(8) 환경변수 추가 설정

 (5)번 에서의 환경변수 설정 방법으로 시스템 환경변수에 
 변수명 PYTHONPATH,  변수값 C:\atari-py:$PYTHONPATH
  로 설정해 줍니다

(9) 테스트

  • Terminal 에서 그대로 python 명령을 해주면 python console로 들어갑니다 (혹은 PyCharm 같은 IDE 에서 실행)

따란~ 하고 잘 되길 바랍니다!

Sort:  

Congratulations @smilekhy! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You published your First Post
You got a First Vote

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @smilekhy! You have received a personal award!

1 Year on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard:

SteemitBoard Ranking update - Resteem and Resteemed added

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @smilekhy! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

SteemFest⁴ commemorative badge refactored
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.030
BTC 63286.07
ETH 2472.36
USDT 1.00
SBD 2.66