nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 121 lines 2.6 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 setuptools, 9 10 # dependencies 11 cloudpickle, 12 farama-notifications, 13 numpy, 14 typing-extensions, 15 16 # optional-dependencies 17 # atari 18 ale-py, 19 20 # tests 21 array-api-compat, 22 dill, 23 flax, 24 jax, 25 jaxlib, 26 matplotlib, 27 mujoco, 28 moviepy, 29 opencv4, 30 pybox2d, 31 pygame, 32 pytestCheckHook, 33 scipy, 34 torch, 35}: 36 37buildPythonPackage rec { 38 pname = "gymnasium"; 39 version = "1.2.3"; 40 41 pyproject = true; 42 43 src = fetchFromGitHub { 44 owner = "Farama-Foundation"; 45 repo = "gymnasium"; 46 tag = "v${version}"; 47 hash = "sha256-b712BPs7AS8UE8Zsu9GW/J6Vag9NB/x728MtQ5yrjbY="; 48 }; 49 50 build-system = [ setuptools ]; 51 52 dependencies = [ 53 cloudpickle 54 farama-notifications 55 numpy 56 typing-extensions 57 ]; 58 59 optional-dependencies = { 60 atari = [ 61 ale-py 62 ]; 63 }; 64 65 pythonImportsCheck = [ "gymnasium" ]; 66 67 nativeCheckInputs = [ 68 array-api-compat 69 dill 70 flax 71 jax 72 jaxlib 73 matplotlib 74 moviepy 75 mujoco 76 opencv4 77 pybox2d 78 pygame 79 pytestCheckHook 80 scipy 81 torch 82 ]; 83 84 # if `doCheck = true` on Darwin, `jaxlib` is evaluated, which is both 85 # marked as broken and throws an error during evaluation if the package is evaluated anyway. 86 # disabling checks on Darwin avoids this and allows the package to be built. 87 # if jaxlib is ever fixed on Darwin, remove this. 88 doCheck = !stdenv.hostPlatform.isDarwin; 89 90 disabledTestPaths = [ 91 # Unpackaged `mujoco-py` (Openai's mujoco) is required for these tests. 92 "tests/envs/mujoco/test_mujoco_custom_env.py" 93 "tests/envs/mujoco/test_mujoco_rendering.py" 94 "tests/envs/mujoco/test_mujoco_v5.py" 95 96 # Rendering tests failing in the sandbox 97 "tests/wrappers/vector/test_human_rendering.py" 98 99 # These tests need to write on the filesystem which cause them to fail. 100 "tests/utils/test_save_video.py" 101 "tests/wrappers/test_record_video.py" 102 ]; 103 104 preCheck = '' 105 export SDL_VIDEODRIVER=dummy 106 ''; 107 108 disabledTests = [ 109 # Succeeds for most environments but `test_render_modes[Reacher-v4]` fails because it requires 110 # OpenGL access which is not possible inside the sandbox. 111 "test_render_mode" 112 ]; 113 114 meta = { 115 description = "Standard API for reinforcement learning and a diverse set of reference environments (formerly Gym)"; 116 homepage = "https://github.com/Farama-Foundation/Gymnasium"; 117 changelog = "https://github.com/Farama-Foundation/Gymnasium/releases/tag/v${version}"; 118 license = lib.licenses.mit; 119 maintainers = with lib.maintainers; [ GaetanLepage ]; 120 }; 121}