-
Notifications
You must be signed in to change notification settings - Fork 173
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
compatibility issue with latest gym (0.26.1) and stable -baseline3 (2.0.0)[ #67
Comments
Hi @Ganesh-mali, there is a related issue to reference for this #63. You need to downgrade your stable-baselines3 installation, preferably to 1.7.0 or 1.8.0. CityLearn is still a gym environment whereas later stable-baselines3 releases support gymnasium environments. |
hey @kingsleynweye thank you for your reply, I tried downgrading to both 1.7.0 as well as 1.8.0. I get new error with that : Building wheels for collected packages: gym × python setup.py bdist_wheel did not run successfully. Let me know , if you need more info. |
@Ganesh-mali this error is a recently known pip install pip==21.3.1
pip install setuptools==41.2.0
pip install CityLearn==2.0b4
pip install stable-baselines3==1.7.0 |
@Ganesh-mali hmmnn I have not seen this before. If I understand correctly, it is the |
hey @kingsleynweye , this time I created a virtual environment using Venv and repeated your steps, Again same error, the first three ran successfully and the installation of stable-baseline3 failed again.
If you need more info please let me know. Or If you have any other suggestions, I will follow your guidelines I just want to run the code that is on Citylearn documentation. |
I have an update, I have installed all for packages as you said, After running the code I am getting this error now :
|
Hey @kingsleynweye any update on this ? |
This is indeed a bug. The library needs to depend on |
@Ganesh-mali this part of the error: obs, info = self.env.reset(**kwargs)
ValueError: not enough values to unpack (expected 2, got 1) makes me believe the issue is caused by your installation of stable-baselines3 expecting a gymnasium environment where the To avoid this problem, you need to use a stable-baselines3 version compatible with |
@H-Park yeah, ideally, we would upgrade |
Forgot to mention that another way I have been able to solve this problem is by installing shimmy that provides a |
@kingsleynweye the dataset given in the example code "baeda_3dem" doesn't work, I even checked using the method Datset.get_names(). It printed all available datasets except baeda_3dem. Anyways, it is working with other datasets, I am able to run the code with SB3 (1.7.0), and gym (0.21.0). Thanks for all your suggestions. |
@Ganesh-mali, if |
This is the new issue with running the code, i am not sure...if any of these examples can be run as it is 130 if not deterministic: TypeError: update() got an unexpected keyword argument 'done' |
What examples are you referring to? With the current code, I was able to run all sections of quickstart.ipynb but |
----------------- CALCULATE NUMBER OF TRAINING EPISODES -----------------i = 3 ------------------------------- SET LOADER ------------------------------loader = get_loader(max=tql_episodes*t) ----------------------- SET MODEL HYPERPARAMETERS -----------------------tql_kwargs = { ----------------------- INITIALIZE AND TRAIN MODEL ----------------------tql_model = CustomTabularQLearning( the last line giving this error. can you please check this once |
Oh I see. The as-provided notebook works fine for me in Colab (https://colab.research.google.com/github/intelligent-environments-lab/CityLearn/blob/master/examples/citylearn_rlem23_tutorial.ipynb). Pleae, can I see what the error message is? |
Hey,Can you explain specifically how to use [shimmy] to solve this bug? Thanks~ |
You will want to install it with stable-baselines3. For example: pip install stable-baselines3==2.1.0
pip install shimmy==0.2.1 Other version numbers for either package might work. |
Issue Description
I am encountering an error while running the code provided in the official CityLearn documentation. I have not modified a single line of the code, and I'm using the exact code snippet provided.
Expected Behavior
I expected the code to run without errors, as it's directly taken from the official CityLearn documentation.
Actual Behavior
I am facing the following error:
ValueError: not enough values to unpack (expected 2, got 1)
Steps to Reproduce
Install CityLearn (version 2.0b4), Stable Baselines 3 (version 2.0.0), and Gym (version 0.26.1).
Run the code provided in the official CityLearn documentation:(https://www.citylearn.net/quickstart.html)
Code:
from stable_baselines3.sac import SAC
from citylearn.citylearn import CityLearnEnv
from citylearn.wrappers import NormalizedObservationWrapper, StableBaselines3Wrapper
dataset_name = 'baeda_3dem'
env = CityLearnEnv(dataset_name, central_agent=True, simulation_end_time_step=1000)
env = NormalizedObservationWrapper(env)
env = StableBaselines3Wrapper(env)
model = SAC('MlpPolicy', env)
model.learn(total_timesteps=env.time_steps*2)
evaluate
observations = env.reset()
while not env.done:
actions, _ = model.predict(observations, deterministic=True)
observations, _, _, _ = env.step(actions)
kpis = env.evaluate().pivot(index='cost_function', columns='name', values='value')
kpis = kpis.dropna(how='all')
display(kpis)
Environment
CityLearn version: 2.0b4
Operating System: Windows
Python version: 3.10
Possible Solution
I have tried various solutions and referred to the official documentation, but I am unable to find a compatible version combination that resolves this issue. I'm looking for guidance from the community.
Additional Notes
I'm following the instructions exactly as provided in the official documentation, so I'm puzzled as to why I'm encountering this issue. If anyone has experience with these libraries and can provide guidance or suggestions, I would greatly appreciate it.
Thank you for your time and assistance!
The text was updated successfully, but these errors were encountered: