Skip to content

Commit ef6d77c

Browse files

File tree

1 file changed

+41
-14
lines changed

1 file changed

+41
-14
lines changed

pkgs/development/python-modules/ale-py/default.nix

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
ninja,
1010
pybind11,
1111
setuptools,
12-
wheel,
1312

1413
# buildInputs
1514
SDL2,
15+
opencv,
1616
zlib,
1717

1818
# dependencies
@@ -22,35 +22,45 @@
2222

2323
# tests
2424
gymnasium,
25+
opencv-python,
2526
pytestCheckHook,
27+
28+
# Whether to enable recently added vector environments:
29+
# https://github.com/Farama-Foundation/Arcade-Learning-Environment/blob/v0.11.0/docs/vector-environment.md
30+
# FIXME: Disabled by default as it mysteriously causes stable-baselines3's tests to hang indefinitely.
31+
withVectorEnv ? false,
2632
}:
2733

2834
buildPythonPackage rec {
2935
pname = "ale-py";
30-
version = "0.10.2";
36+
version = "0.11.0";
3137
pyproject = true;
3238

3339
src = fetchFromGitHub {
3440
owner = "Farama-Foundation";
3541
repo = "Arcade-Learning-Environment";
3642
tag = "v${version}";
37-
hash = "sha256-CGUlQFQoQZqs+Jd3IU/o50VwX+tEHrs3KHrcVWahEpo=";
43+
hash = "sha256-RgFVpbjJp54FncQzFtdZM7p/1GBMsQ2HvLgIoaokiQc=";
3844
};
3945

4046
build-system = [
4147
cmake
4248
ninja
4349
pybind11
4450
setuptools
45-
wheel
4651
];
4752

48-
buildInputs = [
49-
SDL2
50-
zlib
51-
];
53+
buildInputs =
54+
[
55+
SDL2
56+
zlib
57+
]
58+
++ lib.optionals withVectorEnv [
59+
opencv
60+
];
5261

5362
dependencies = [
63+
gymnasium
5464
importlib-resources
5565
numpy
5666
typing-extensions
@@ -60,17 +70,31 @@ buildPythonPackage rec {
6070
# Relax the pybind11 version
6171
''
6272
substituteInPlace src/ale/python/CMakeLists.txt \
63-
--replace-fail 'find_package(pybind11 ''${PYBIND11_VER} QUIET)' 'find_package(pybind11 QUIET)'
73+
--replace-fail \
74+
'find_package(pybind11 ''${PYBIND11_VER} QUIET)' \
75+
'find_package(pybind11 QUIET)'
76+
''
77+
+ lib.optionalString (!withVectorEnv) ''
78+
substituteInPlace setup.py \
79+
--replace-fail \
80+
"-DBUILD_VECTOR_LIB=ON" \
81+
"-DBUILD_VECTOR_LIB=OFF"
6482
'';
6583

6684
dontUseCmakeConfigure = true;
6785

6886
pythonImportsCheck = [ "ale_py" ];
6987

70-
nativeCheckInputs = [
71-
gymnasium
72-
pytestCheckHook
73-
];
88+
doCheck = false;
89+
90+
nativeCheckInputs =
91+
[
92+
gymnasium
93+
pytestCheckHook
94+
]
95+
+ lib.optionals withVectorEnv [
96+
opencv-python
97+
];
7498

7599
disabledTests = [
76100
# Fatal Python error: Aborted
@@ -81,6 +105,8 @@ buildPythonPackage rec {
81105
# The user is expected to manually download the roms:
82106
# 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
83107
"test_check_env"
108+
"test_reset_step_shapes"
109+
"test_rollout_consistency"
84110
"test_sound_obs"
85111
];
86112

@@ -92,7 +118,8 @@ buildPythonPackage rec {
92118
license = lib.licenses.gpl2;
93119
maintainers = with lib.maintainers; [ billhuang ];
94120
badPlatforms = [
95-
# fails to link with missing library
121+
# FAILED: src/ale/libale.a
122+
# /bin/sh: CMAKE_CXX_COMPILER_AR-NOTFOUND: command not found
96123
lib.systems.inspect.patterns.isDarwin
97124
];
98125
};

0 commit comments

Comments
 (0)