Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 131 lines 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 cmake, 9 ninja, 10 pybind11, 11 setuptools, 12 13 # buildInputs 14 SDL2, 15 opencv, 16 zlib, 17 18 # dependencies 19 importlib-resources, 20 numpy, 21 typing-extensions, 22 jax, 23 24 # tests 25 gymnasium, 26 opencv-python, 27 pytestCheckHook, 28 29 # Whether to enable recently added vector environments: 30 # https://github.com/Farama-Foundation/Arcade-Learning-Environment/blob/v0.11.0/docs/vector-environment.md 31 # FIXME: Disabled by default as it mysteriously causes stable-baselines3's tests to hang indefinitely. 32 withVectorEnv ? false, 33}: 34 35buildPythonPackage rec { 36 pname = "ale-py"; 37 version = "0.11.1"; 38 pyproject = true; 39 40 src = fetchFromGitHub { 41 owner = "Farama-Foundation"; 42 repo = "Arcade-Learning-Environment"; 43 tag = "v${version}"; 44 hash = "sha256-VrPc3i1VYuThKdQn/wimNzMHNmPIAdTxbh2tuJb4YJY="; 45 }; 46 47 build-system = [ 48 cmake 49 ninja 50 pybind11 51 setuptools 52 ]; 53 54 buildInputs = 55 [ 56 SDL2 57 zlib 58 ] 59 ++ lib.optionals withVectorEnv [ 60 opencv 61 ]; 62 63 dependencies = 64 [ 65 gymnasium 66 importlib-resources 67 numpy 68 typing-extensions 69 ] 70 ++ lib.optionals stdenv.hostPlatform.isLinux [ 71 jax 72 ]; 73 74 postPatch = 75 # Relax the pybind11 version 76 '' 77 substituteInPlace src/ale/python/CMakeLists.txt \ 78 --replace-fail \ 79 'find_package(pybind11 ''${PYBIND11_VER} QUIET)' \ 80 'find_package(pybind11 QUIET)' 81 '' 82 + lib.optionalString (!withVectorEnv) '' 83 substituteInPlace setup.py \ 84 --replace-fail \ 85 "-DBUILD_VECTOR_LIB=ON" \ 86 "-DBUILD_VECTOR_LIB=OFF" 87 ''; 88 89 dontUseCmakeConfigure = true; 90 91 pythonImportsCheck = [ "ale_py" ]; 92 93 doCheck = false; 94 95 nativeCheckInputs = 96 [ 97 gymnasium 98 pytestCheckHook 99 ] 100 + lib.optionals withVectorEnv [ 101 opencv-python 102 ]; 103 104 disabledTests = [ 105 # Fatal Python error: Aborted 106 # line 414 in test_display_screen 107 "test_display_screen" 108 109 # test_atari_env.py tests fail on the majority of the environments because the ROM are missing. 110 # The user is expected to manually download the roms: 111 # https://github.com/Farama-Foundation/Arcade-Learning-Environment/blob/v0.9.0/docs/faq.md#i-downloaded-ale-and-i-installed-it-successfully-but-i-cannot-find-any-rom-file-at-roms-do-i-have-to-get-them-somewhere-else 112 "test_check_env" 113 "test_reset_step_shapes" 114 "test_rollout_consistency" 115 "test_sound_obs" 116 ]; 117 118 meta = { 119 description = "Simple framework that allows researchers and hobbyists to develop AI agents for Atari 2600 games"; 120 mainProgram = "ale-import-roms"; 121 homepage = "https://github.com/mgbellemare/Arcade-Learning-Environment"; 122 changelog = "https://github.com/Farama-Foundation/Arcade-Learning-Environment/releases/tag/v${version}"; 123 license = lib.licenses.gpl2; 124 maintainers = with lib.maintainers; [ billhuang ]; 125 badPlatforms = [ 126 # FAILED: src/ale/libale.a 127 # /bin/sh: CMAKE_CXX_COMPILER_AR-NOTFOUND: command not found 128 lib.systems.inspect.patterns.isDarwin 129 ]; 130 }; 131}