Stable-Baselines-Team / stable-baselines3-contrib

Contrib package for Stable-Baselines3 - Experimental reinforcement learning (RL) code
https://sb3-contrib.readthedocs.io
MIT License
504 stars 175 forks source link

seems that python3.10 not include all sb3_contrib yet #184

Closed Pborz closed 1 year ago

Pborz commented 1 year ago

from sb3_contrib import RecurrentPPO

ImportError: cannot import name 'RecurrentPPO' from 'sb3_contrib' (/usr/local/lib/python3.10/dist-packages/sb3_contrib/init.py)

then

cat /usr/local/lib/python3.10/dist-packages/sb3_contrib/init.py

import os

from sb3_contrib.qrdqn import QRDQN from sb3_contrib.tqc import TQC

Read version from file

version_file = os.path.join(os.path.dirname(file), "version.txt") with open(version_file, "r") as file_handler: version = file_handler.read().strip()

---so only QRDQN and TQC now ?

Pborz commented 1 year ago

i mean when simply pip install sb3-contrib in google colab, then we'll got a packages that only has QRDQN and TQC now , but use pip install git+https://github.com/Stable-Baselines-Team/stable-baselines3-contrib, then all policies and algorithm are ok.

araffin commented 1 year ago

i mean when simply pip install sb3-contrib in google colab, then we'll got a packages that only has QRDQN and TQC now , but use pip install git+https://github.com/Stable-Baselines-Team/stable-baselines3-contrib, then all policies and algorithm are ok.

For SB3 contrib 1.x, doing:

!pip install setuptools==65.5.0 pip==21  # gym 0.21 installation is broken with more recent versions
!pip install sb3_contrib --upgrade

installs sb3 contrib 1.8.0 that has all algorithms describe in the doc.

If you want gymnasium support (or don't want to downgrade setuptools/pip), you can either install sb3 contrib 2.x or use the master version as you wrote:

!pip install "sb3_contrib>=2.0.0a9"