From 213b06b0c6e03abeb3253f5c55112d667f9c298b Mon Sep 17 00:00:00 2001 From: Antonin Raffin Date: Mon, 19 Dec 2022 13:20:48 +0100 Subject: [PATCH] Monkey-patch `np.bool = bool` --- setup.py | 2 +- stable_baselines3/__init__.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9bb5b97..b02e9e4 100644 --- a/setup.py +++ b/setup.py @@ -77,7 +77,7 @@ setup( package_data={"stable_baselines3": ["py.typed", "version.txt"]}, install_requires=[ "gym==0.21", # Fixed version due to breaking changes in 0.22 - "numpy<1.24", # Required for gym==0.21 + "numpy", "torch>=1.11", 'typing_extensions>=4.0,<5; python_version < "3.8.0"', # For saving models diff --git a/stable_baselines3/__init__.py b/stable_baselines3/__init__.py index 0775a8e..e1606bd 100644 --- a/stable_baselines3/__init__.py +++ b/stable_baselines3/__init__.py @@ -1,5 +1,7 @@ import os +import numpy as np + from stable_baselines3.a2c import A2C from stable_baselines3.common.utils import get_system_info from stable_baselines3.ddpg import DDPG @@ -9,6 +11,10 @@ from stable_baselines3.ppo import PPO from stable_baselines3.sac import SAC from stable_baselines3.td3 import TD3 +# Small monkey patch so gym 0.21 is compatible with numpy >= 1.24 +# TODO: remove when upgrading to gym 0.26 +np.bool = bool + # Read version from file version_file = os.path.join(os.path.dirname(__file__), "version.txt") with open(version_file) as file_handler: