pfnet / pfrl

PFRL: a PyTorch-based deep reinforcement learning library
MIT License
1.18k stars 158 forks source link

pin the gym version in the requirements.txt, latest gym breaks pfrl #166

Closed erwincoumans closed 2 years ago

erwincoumans commented 2 years ago

Getting an error, probably due to versioning issue between pfrl 0.2.1 and gym 0.23.0:

d:\python-x64\lib\site-packages\pfrl\wrappers\monitor.py line 4: ImportError: cannot import name 'Monitor' from 'gym.wrappers' (D:\python-x64\lib\site-packages\gym\wrappers__init__.py)

python -m pip list
Package                              Version   Location
------------------------------------ --------- -----------------------
gym                                  0.23.0
pfrl                                 0.2.1

Downgrading gym fixes it:

python -m pip uninstall gym
python -m pip install gym==0.14.0

Could you pin the gym version in the requirements.txt?

muupan commented 2 years ago

Thanks for reporting the issue! I reproduced this in my environment. import pfrl fails for gym==0.23.0 due to the removal of Monitor class. This issue must be fixed. A workaround is to use gym<=0.22.0.