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

[DO NOT MERGE] Update to 1.0.0 alpha2 #36

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
83014e5
Update to 1.0.0 alpha1
traversaro Apr 6, 2024
ed69344
Update meta.yaml
traversaro Apr 6, 2024
17f5344
Update requirement list
pseudo-rnd-thoughts Apr 6, 2024
ee7c555
Update meta.yaml
traversaro Apr 6, 2024
c7ba3fd
Remove cython dependency from gymnasium-mujoco
traversaro Apr 8, 2024
77b1438
Update for Alpha 2
pseudo-rnd-thoughts May 21, 2024
ab677e9
Fix sha256
pseudo-rnd-thoughts May 21, 2024
d41a48e
Create 1060.patch
traversaro May 21, 2024
c5f0fa1
Update meta.yaml
traversaro May 21, 2024
c49cc07
Update meta.yaml
traversaro May 22, 2024
8f263ef
Update meta.yaml
traversaro May 22, 2024
9daa0a0
Update meta.yaml
traversaro May 22, 2024
dbafe3f
Update meta.yaml
traversaro May 22, 2024
968aea0
Update meta.yaml
traversaro May 22, 2024
4f7c97a
Update meta.yaml
traversaro May 22, 2024
897d31a
Update meta.yaml
traversaro May 22, 2024
74e52fd
Update meta.yaml
traversaro May 22, 2024
ad7e21b
Update meta.yaml
traversaro May 22, 2024
b46e50f
Update meta.yaml
traversaro May 24, 2024
71c8a6c
Create 1065.patch
traversaro May 24, 2024
671c171
Update meta.yaml
traversaro May 24, 2024
bc3f555
Update meta.yaml
traversaro May 24, 2024
4b5c798
Update meta.yaml
traversaro May 24, 2024
d2f4cfc
Create 1066.patch
traversaro May 24, 2024
593c7f8
Delete recipe/patches/932.patch
traversaro May 24, 2024
955d9b7
Update meta.yaml
traversaro May 24, 2024
4ac2094
Update meta.yaml
traversaro May 26, 2024
9f44e5b
Update meta.yaml
traversaro May 26, 2024
24e9d79
Update meta.yaml
traversaro May 26, 2024
a1b7057
Update meta.yaml
traversaro May 27, 2024
bb08af2
Update meta.yaml
traversaro May 27, 2024
36c0cc8
Update meta.yaml
traversaro May 28, 2024
453fe7e
Update meta.yaml
traversaro May 28, 2024
8076119
Update meta.yaml
traversaro May 28, 2024
cbd34d7
Skip more tests on aarch64
traversaro May 28, 2024
497ee34
Update recipe/meta.yaml
traversaro Jun 12, 2024
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
44 changes: 44 additions & 0 deletions recipe/1060.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
From c72daa87f6eebf7a14057ab7e70ed8c74d021a4a Mon Sep 17 00:00:00 2001
From: Silvio Traversaro <[email protected]>
Date: Tue, 21 May 2024 22:59:48 +0200
Subject: [PATCH] mujoco_py_env: Only raise an exception if MuJocoPyEnv class
is actually used

---
gymnasium/envs/mujoco/mujoco_py_env.py | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/gymnasium/envs/mujoco/mujoco_py_env.py b/gymnasium/envs/mujoco/mujoco_py_env.py
index 8d2949102..a15ac7a5a 100644
--- a/gymnasium/envs/mujoco/mujoco_py_env.py
+++ b/gymnasium/envs/mujoco/mujoco_py_env.py
@@ -12,11 +12,9 @@
try:
import mujoco_py
except ImportError as e:
- raise error.DependencyNotInstalled(
- "Could not import mujoco_py, which is needed for MuJoCo environments older than V4",
- "You could either use a newer version of the environments, or install the (deprecated) mujoco-py package"
- "following the instructions on their GitHub page.",
- ) from e
+ MUJOCO_PY_IMPORT_ERROR = e
+else:
+ MUJOCO_PY_IMPORT_ERROR = None


# NOTE: duplication of analogous code in mujoco_env.py
@@ -214,6 +212,14 @@ def __init__(
camera_id: Optional[int] = None,
camera_name: Optional[str] = None,
):
+ if MUJOCO_PY_IMPORT_ERROR is not None:
+ raise error.DependencyNotInstalled(
+ f"{MUJOCO_PY_IMPORT_ERROR}. "
+ "Could not import mujoco_py, which is needed for MuJoCo environments older than V4",
+ "You could either use a newer version of the environments, or install the (deprecated) mujoco-py package"
+ "following the instructions on their GitHub page.",
+ )
+
logger.deprecation(
"This version of the mujoco environments depends "
"on the mujoco-py bindings, which are no longer maintained "
80 changes: 62 additions & 18 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
{% set version = "0.29.1" %}
{% set version = "1.0.0" %}

package:
name: gymnasium-split
version: {{ version }}

source:
url: https://github.com/Farama-Foundation/Gymnasium/archive/refs/tags/v{{ version }}.tar.gz
sha256: 0bff5ff33335ffe170f9ccba544f7c4d78e7b4dd883337f2ee00f8ba3c6d85b5
url: https://github.com/Farama-Foundation/Gymnasium/archive/refs/tags/v{{ version }}a2.tar.gz
sha256: 8e05eb7b41aaa2c7cd2fca7fc8f380ca38a814a5fdc67d9ce8614e5014c90683
patches:
# https://github.com/Farama-Foundation/Gymnasium/pull/932
- patches/932.patch
# https://github.com/Farama-Foundation/Gymnasium/pull/1060
- 1060.patch
# https://github.com/Farama-Foundation/Gymnasium/pull/1065
Comment on lines +11 to +12
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to be consistent and also move this into the patches folder

- patches/1065.patch
# https://github.com/Farama-Foundation/Gymnasium/pull/1066
- patches/1066.patch

build:
number: 1
number: 0

# Need these up here for conda-smithy to handle them properly.
requirements:
Expand Down Expand Up @@ -47,7 +51,6 @@ outputs:
- cloudpickle >=1.2.0
- farama-notifications
- numpy
- jax-jumpy >=1.0.0
- typing_extensions >=4.3.0
- importlib_metadata >=4.8.1 # [py<=39]
test:
Expand All @@ -72,15 +75,43 @@ outputs:
source_files:
- tests/
requires:
- pip
- mock
- pytest
- scipy
- pip
- jax >=0.4 # [osx or linux64]
- dill
# Recent versions of jax are not available on Python 3.8
# https://github.com/conda-forge/jax-feedstock/pull/123
# jax is not properly working in linux-aarch64
# https://github.com/conda-forge/jax-feedstock/issues/144
- jax >=0.4 # [unix and not ppc64le and not aarch64 and py != 38]
- flax # [unix and not ppc64le and not aarch64 and py != 38]
- pytorch >=1.0 # [unix and not ppc64le]
traversaro marked this conversation as resolved.
Show resolved Hide resolved
- mesalib # [linux]
- mujoco-python
# Use headless opencv for tests (see https://github.com/conda-forge/opencv-feedstock/issues/401)
# This is especially useful when cross-compiling as tests are emulated but CDT may not be available
- libopencv *=headless* # [aarch64]
commands:
- pip check
# On Python 3.8 do not do pip check, see https://github.com/conda-forge/gymnasium-feedstock/pull/36#issuecomment-2124179635
- pip check # [py != 38]
{% set tests_to_skip = "_not_a_real_test" %}
# These test requires mujoco_py, see https://github.com/conda-forge/gymnasium-feedstock/pull/36#issuecomment-2124082918
{% set tests_to_skip = tests_to_skip + " or test_verify_info_x_position" %}
{% set tests_to_skip = tests_to_skip + " or test_verify_info_y_position" %}
{% set tests_to_skip = tests_to_skip + " or test_verify_info_x_velocity" %}
{% set tests_to_skip = tests_to_skip + " or test_verify_info_y_velocity" %}
{% set tests_to_skip = tests_to_skip + " or test_verify_info_xy_velocity_xpos" %}
{% set tests_to_skip = tests_to_skip + " or test_verify_info_xy_velocity_com" %}
{% set tests_to_skip = tests_to_skip + " or test_set_state" %}
{% set tests_to_skip = tests_to_skip + " or test_distance_from_origin_info" %}
{% set tests_to_skip = tests_to_skip + " or test_model_sensors" %}
{% set tests_to_skip = tests_to_skip + " or test_reset_noise_scale" %}
# These tests do not run on CI due to missing window system, see https://github.com/conda-forge/gymnasium-feedstock/pull/36#issuecomment-2124183361
{% set tests_to_skip = tests_to_skip + " or test_max_geom_attribute[10-human]" %}
{% set tests_to_skip = tests_to_skip + " or test_max_geom_attribute[100-human]" %}
{% set tests_to_skip = tests_to_skip + " or test_max_geom_attribute[1000-human]" %}
{% set tests_to_skip = tests_to_skip + " or test_max_geom_attribute[10000-human]" %}
# the following pygame tests are skipped [according to selector], because there is no rendering support during the CI build
{% set tests_to_skip = tests_to_skip + " or test_human_rendering" %} # [osx]
{% set tests_to_skip = tests_to_skip + " or test_keyboard_irrelevant_keydown_event" %} # [osx]
Expand All @@ -93,11 +124,28 @@ outputs:
{% set tests_to_skip = tests_to_skip + " or test_play_relevant_keys" %} # [osx]
{% set tests_to_skip = tests_to_skip + " or test_pygame_quit_event" %} # [osx]
{% set tests_to_skip = tests_to_skip + " or test_video_size_no_zoom" %} # [osx]
{% set tests_to_skip = tests_to_skip + " or test_video_size_zoom" %} # [osx]
{% set tests_to_skip = tests_to_skip + " or test_offscreen_viewer_custom_dimensions" %} # [osx or win]
{% set tests_to_skip = tests_to_skip + " or test_max_geom_attribute" %} # [osx or win]
# See https://github.com/conda-forge/gymnasium-feedstock/pull/32#issuecomment-2031810613
{% set tests_to_skip = tests_to_skip + " or test_render_modes" %} # [aarch64]
# https://github.com/conda-forge/gymnasium-feedstock/pull/36#issuecomment-2124810832
{% set tests_to_skip = tests_to_skip + " or test_model_object_count[v5]" %} # [py == 38]
# https://github.com/conda-forge/gymnasium-feedstock/pull/36#issuecomment-2132386189
{% set tests_to_skip = tests_to_skip + " or test_cartpole_vector_equiv" %} # [py == 38]
# This test use fork, that is not available on Windows
{% set tests_to_skip = tests_to_skip + " or test_async_with_dynamically_registered_env[fork" %} # [win]
{% set tests_to_skip = tests_to_skip + " or test_shared_memory_create_read_write[fork" %} # [win]
# Test that fail on aarch64
{% set tests_to_skip = tests_to_skip + " or test_offscreen_viewer_custom_dimensions" %} # [aarch64]
{% set tests_to_skip = tests_to_skip + " or test_resize" %} # [aarch64]
# need to specify opengl driver on linux to enable offscreen rendering in MuJoCo
- export MUJOCO_GL="osmesa" # [linux]
# Ensure that pygame tests pass on osx,
# see https://github.com/conda-forge/gymnasium-feedstock/pull/36#issuecomment-2124699477
- export SDL_VIDEODRIVER="dummy" # [osx]
# Test that results in crashes on aarch64 during collection
- rm tests/envs/mujoco/test_mujoco_v5.py # [aarch64]
- rm tests/wrappers/test_atari_preprocessing.py # [aarch64]
- pytest -v tests/ -k "not ({{ tests_to_skip }})"

- name: gymnasium-atari
Expand All @@ -107,10 +155,10 @@ outputs:
run:
- python
- {{ pin_subpackage('gymnasium', exact=True) }}
- shimmy-atari
- ale-py
test:
commands:
- echo "tested in shimmy-atari"
- echo "tested in ale-py"

- name: gymnasium-box2d
requirements:
Expand Down Expand Up @@ -145,10 +193,7 @@ outputs:
run:
- python
- {{ pin_subpackage('gymnasium', exact=True) }}
- cython <3
# Maximum version of mujoco constraint required due to https://github.com/Farama-Foundation/Gymnasium/issues/749#issuecomment-1808355111,
# remove once gymnasium v1.0.0 is released
- mujoco-python >=2.3.3,<3.0.0
- mujoco-python >=2.3.3
- imageio >=2.14.1
test:
imports:
Expand Down Expand Up @@ -194,7 +239,6 @@ outputs:
- matplotlib >=3.0
- moviepy >=1.0
- py-opencv >=3.0
- pytorch >=1.0 # [unix and not ppc64le]
test:
imports:
# There are no tests in the source code for gymnasium-other
Expand Down
30 changes: 30 additions & 0 deletions recipe/patches/1065.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 36e67165ba693cfe80bf2c6b02e5278fe435f9c8 Mon Sep 17 00:00:00 2001
From: Silvio Traversaro <[email protected]>
Date: Fri, 24 May 2024 16:24:09 +0200
Subject: [PATCH] Fix RescaleObservation on Windows

---
gymnasium/wrappers/transform_observation.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gymnasium/wrappers/transform_observation.py b/gymnasium/wrappers/transform_observation.py
index b288c426c..a95daf6ce 100644
--- a/gymnasium/wrappers/transform_observation.py
+++ b/gymnasium/wrappers/transform_observation.py
@@ -517,9 +517,14 @@ def __init__(
self.max_obs = max_obs

# Imagine the x-axis between the old Box and the y-axis being the new Box
+ # float128 is not available everywhere
+ try:
+ high_low_diff_dtype = np.float128
+ except AttributeError:
+ high_low_diff_dtype = np.float64
high_low_diff = np.array(
- env.observation_space.high, dtype=np.float128
- ) - np.array(env.observation_space.low, dtype=np.float128)
+ env.observation_space.high, dtype=high_low_diff_dtype
+ ) - np.array(env.observation_space.low, dtype=high_low_diff_dtype)
gradient = np.array(
(max_obs - min_obs) / high_low_diff, dtype=env.observation_space.dtype
)
77 changes: 77 additions & 0 deletions recipe/patches/1066.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
From 13d3653c7a40e2b97bc694f3602a715b2ae6a85f Mon Sep 17 00:00:00 2001
From: Silvio Traversaro <[email protected]>
Date: Fri, 24 May 2024 17:56:31 +0200
Subject: [PATCH] Fix test_dict_info_to_list test on Windows

---
.../wrappers/vector/test_dict_info_to_list.py | 23 ++++++++++++-------
1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/tests/wrappers/vector/test_dict_info_to_list.py b/tests/wrappers/vector/test_dict_info_to_list.py
index 9e61f29b9..f07c97005 100644
--- a/tests/wrappers/vector/test_dict_info_to_list.py
+++ b/tests/wrappers/vector/test_dict_info_to_list.py
@@ -60,9 +60,13 @@ def test_update_info():
"_e": np.array([True]),
}
_, list_info = env.reset(options=vector_infos)
+
+ # The return dtype of np.array([0]) is platform dependent
+ np_array_int_default_dtype = np.array([0]).dtype.type
+
expected_list_info = [
{
- "a": np.int64(0),
+ "a": np_array_int_default_dtype(0),
"b": np.float64(0.0),
"c": None,
"d": np.zeros((2,)),
@@ -90,21 +94,21 @@ def test_update_info():
_, list_info = env.reset(options=vector_infos)
expected_list_info = [
{
- "a": np.int64(0),
+ "a": np_array_int_default_dtype(0),
"b": np.float64(0.0),
"c": None,
"d": np.zeros((2,)),
"e": Discrete(1),
},
{
- "a": np.int64(1),
+ "a": np_array_int_default_dtype(1),
"b": np.float64(1.0),
"c": None,
"d": np.zeros((2,)),
"e": Discrete(2),
},
{
- "a": np.int64(2),
+ "a": np_array_int_default_dtype(2),
"b": np.float64(2.0),
"c": None,
"d": np.zeros((2,)),
@@ -134,7 +138,7 @@ def test_update_info():
}
_, list_info = env.reset(options=vector_infos)
expected_list_info = [
- {"a": np.int64(1), "b": np.float64(1.0)},
+ {"a": np_array_int_default_dtype(1), "b": np.float64(1.0)},
{"c": None, "d": np.zeros((2,))},
{"e": Discrete(3)},
]
@@ -156,8 +160,11 @@ def test_update_info():
}
_, list_info = env.reset(options=vector_infos)
expected_list_info = [
- {"episode": {"a": np.int64(1), "b": np.float64(1.0)}},
- {"episode": {"a": np.int64(2), "b": np.float64(2.0)}, "a": np.int64(1)},
- {"a": np.int64(2)},
+ {"episode": {"a": np_array_int_default_dtype(1), "b": np.float64(1.0)}},
+ {
+ "episode": {"a": np_array_int_default_dtype(2), "b": np.float64(2.0)},
+ "a": np_array_int_default_dtype(1),
+ },
+ {"a": np_array_int_default_dtype(2)},
]
assert data_equivalence(list_info, expected_list_info)
13 changes: 0 additions & 13 deletions recipe/patches/932.patch

This file was deleted.

Loading