Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python312Packages.gymnasium: 0.29.1 -> 1.0.0 #313379

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 39 additions & 22 deletions pkgs/development/python-modules/gymnasium/default.nix
Original file line number Diff line number Diff line change
@@ -1,60 +1,67 @@
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,

# build-system
setuptools,
numpy,

# dependencies
cloudpickle,
gym-notices,
jax-jumpy,
typing-extensions,
farama-notifications,
importlib-metadata,
numpy,
typing-extensions,
pythonOlder,
ffmpeg,
importlib-metadata,

# tests
dill,
flax,
jax,
jaxlib,
matplotlib,
mujoco,
moviepy,
opencv4,
pybox2d,
pygame,
pytestCheckHook,
scipy,
stdenv,
}:

buildPythonPackage rec {
pname = "gymnasium";
version = "0.29.1";
format = "pyproject";
version = "1.0.0";

pyproject = true;

src = fetchFromGitHub {
owner = "Farama-Foundation";
repo = "gymnasium";
rev = "refs/tags/v${version}";
hash = "sha256-L7fn9FaJzXwQhjDKwI9hlFpbPuQdwynU+Xjd8bbjxiw=";
hash = "sha256-Qchuz08yJ0giVrtKLC9vBgr28JrHQyAOCuoS239ivVw=";
};

nativeBuildInputs = [ setuptools ];
build-system = [ setuptools ];

propagatedBuildInputs = [
dependencies = [
cloudpickle
farama-notifications
gym-notices
jax-jumpy
numpy
typing-extensions
] ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ];

pythonImportsCheck = [ "gymnasium" ];

nativeCheckInputs = [
ffmpeg
dill
flax
jax
jaxlib
matplotlib
moviepy
mujoco
opencv4
pybox2d
pygame
Expand All @@ -69,20 +76,30 @@ buildPythonPackage rec {
doCheck = !stdenv.hostPlatform.isDarwin;

disabledTestPaths = [
# mujoco is required for those tests but the mujoco python bindings are not packaged in nixpkgs.
# Unpackaged `mujoco-py` (Openai's mujoco) is required for these tests.
"tests/envs/mujoco/test_mujoco_custom_env.py"
"tests/envs/mujoco/test_mujoco_rendering.py"
"tests/envs/mujoco/test_mujoco_v5.py"

# Those tests need to write on the filesystem which cause them to fail.
"tests/experimental/wrappers/test_record_video.py"
# Rendering tests failing in the sandbox
"tests/wrappers/vector/test_human_rendering.py"

# These tests need to write on the filesystem which cause them to fail.
"tests/utils/test_save_video.py"
"tests/wrappers/test_record_video.py"
"tests/wrappers/test_video_recorder.py"
];

meta = with lib; {
disabledTests = [
# Succeeds for most environments but `test_render_modes[Reacher-v4]` fails because it requires
# OpenGL access which is not possible inside the sandbox.
"test_render_mode"
samuela marked this conversation as resolved.
Show resolved Hide resolved
];

meta = {
description = "Standard API for reinforcement learning and a diverse set of reference environments (formerly Gym)";
homepage = "https://github.com/Farama-Foundation/Gymnasium";
license = licenses.mit;
maintainers = with maintainers; [ GaetanLepage ];
changelog = "https://github.com/Farama-Foundation/Gymnasium/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}
34 changes: 23 additions & 11 deletions pkgs/development/python-modules/shimmy/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
fetchpatch,

# build-system
setuptools,
wheel,

# dependencies
gymnasium,
numpy,

# tests
ale-py,
bsuite,
dm-control,
Expand All @@ -18,21 +23,32 @@

buildPythonPackage rec {
pname = "shimmy";
version = "1.3.0";
version = "2.0.0";
pyproject = true;

disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "Farama-Foundation";
repo = "Shimmy";
rev = "refs/tags/v${version}";
hash = "sha256-rYBbGyMSFF/iIGruKn2JXKAVIZIfJDEHUEZUESiUg/k=";
hash = "sha256-/wIXjOGb3UeMQdeifYagd7OcxbBcdGPS09mjvkFsWmk=";
};

patches = [
# Shimmy tries to register some environments from `dm-control` that require unpackaged `labmaze`.
# This prevents from importing `shimmy` itself by crashing with a `ModuleNotFoundError`.
# This patch imports those environments lazily.
#
# TODO: get rid of this patch at the next release as the issue has been fixed upstream:
# https://github.com/Farama-Foundation/Shimmy/pull/125
(fetchpatch {
name = "prevent-labmaze-import-crash";
url = "https://github.com/Farama-Foundation/Shimmy/commit/095d576f6aae15a09a1e426138629ce9f43a3c04.patch";
hash = "sha256-rr9l3tHunYFk0j7hfo9IaSRlogAtwXoXcQ0zuU/TL8c=";
})
];

build-system = [
setuptools
wheel
];

dependencies = [
Expand All @@ -58,10 +74,6 @@ buildPythonPackage rec {

# Requires unpackaged pyspiel
"tests/test_openspiel.py"

# Broken since ale-py v0.9.0 due to API change
# https://github.com/Farama-Foundation/Shimmy/issues/120
"tests/test_atari.py"
];

preCheck = ''
Expand Down
11 changes: 5 additions & 6 deletions pkgs/development/python-modules/torchrl/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,

# build-system
Expand Down Expand Up @@ -44,17 +43,13 @@
pytestCheckHook,
pyyaml,
scipy,

stdenv,
}:

buildPythonPackage rec {
pname = "torchrl";
version = "0.5.0";
pyproject = true;

disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "pytorch";
repo = "rl";
Expand Down Expand Up @@ -138,6 +133,11 @@ buildPythonPackage rec {
++ optional-dependencies.rendering;

disabledTests = [
# torchrl is incompatible with gymnasium>=1.0
# https://github.com/pytorch/rl/discussions/2483
"test_resetting_strategies"
"test_torchrl_to_gym"

# mujoco.FatalError: an OpenGL platform library has not been loaded into this process, this most likely means that a valid OpenGL context has not been created before mjr_makeContext was called
"test_vecenvs_env"

Expand Down Expand Up @@ -175,6 +175,5 @@ buildPythonPackage rec {
changelog = "https://github.com/pytorch/rl/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ GaetanLepage ];
# ~3k tests fail with: RuntimeError: internal error
};
}