티스토리 뷰

정보

OpenAI GYM atari-py 설치 오류 해결

람람뿅뿅 2018. 2. 19. 13:19
atari-py_installation_guide

OpenAI's GYM environment installation guide for Reinforcement Learning

updated: 2018.02.19

환경

OS: Windows10 64-bit
Anaconda3 virtualenv
virtual environment version: Python3.6.4

문제상황

강화학습 알고리즘 학습 및 테스트를 위한 OpenAI의 GYM환경을 설치하기위해 https://github.com/rybskej/atari-py 주소에서 설치하던 중, 아나콘다 가상환경에서 다음과 같은 에러가 떳습니다.

-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (PROJECT):
The CMAKE_C_COMPILER:

cl

is not a full path and was not found in the PATH.

To use the NMake generator with Visual C++, cmake must be run from a shell that can use the compiler cl from the command line. This environment is unable to invoke the cl compiler. To fix this problem, run cmake from the Visual Studio Command Prompt (vcvarsall.bat).

Tell CMake where to find the compiler by setting either the environment variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

어찌어찌 넘어가던 도중 이런 에러도 발생했구요.

AttributeError: 'ALEInterface' object has no attribute 'getScreenRGB2'

그래서 다시 찾은 주소는 https://github.com/j8lp/atari-py
입니다.

상기의 주소에 들어가서 Installation 과정을 따라하셔도 좋습니다.

과정

  1. MSYS2설치 http://www.msys2.org/

    • 저는 win64운영체제라서 중간의 'msys2-x86_64-20161025.exe' 를 다운로드 해서 설치했습니다.
  2. 설치한 MSYS2 폴더에 들어가서 msys2.exe를 실행합니다.

    • 저의 경우엔, c:\msys64\ 였습니다.
  3. MSYS2 터미널에서 다음과 같은 명령어를 입력해주세요.
    pacman -S base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake

  4. 설치가 끝난 후, 환경변수 PATH설정을 해줍시다.

    • 제어판에서 환경변수 셋팅에 들어가셔도 좋습니다.
    • 탐색기 -> 내컴퓨터에서 마우스 우클릭 -> 속성 -> 고급시스템설정-> 환경변수

    set PATH=%PATH%;{MSYS 설치 경로\mingw64\bin;MSYS설치경로\usr\bin}

    저의 경우엔...
    set PATH=%PATH%;c:\msys64\mingw64\bin;c:\msys64\usr\bin

  5. Xming을 설치합니다. https://sourceforge.net/projects/xming/

  6. 환경변수에 다음과 같은 변수를 추가합니다.
    변수명 : DISPLAY
    값: :0
    set DISPLAY=:0

  7. atari-py와 OpenAI GYM을 설치합니다.
    > git clone https://github.com/j8lp/atari-py
    cd atari-py && make && python setup.py install &&pip install "gym[atari]"

  8. atari-py 경로를 PYTHONPATH에 추가하면 됩니다.

set PYTHONPATH="{atari-py 폴더경로}:$PYTHONPATH"
set PYTHONPATH="c:\atari-py:$PYTHONPATH"

  1. 테스트
> python

>>> import gym
>>> env = gym.make('SpaceInvaders-v0')
>>> env.reset()
>>> env.render()

스페이스 인베이더 화면이 뜬다면 성공입니다.

가능 환경 (In progress)
  • SpaceInvaders-v0
  • Pong-v0
  • CartPole-v0