Skip to content

[HANDS-ON BUG] Colab + Python 3.12 issues in Unit 1 (Box2D, gymnasium[box2d], and repo publish step) #678

@trewby

Description

@trewby

Describe the bug

When completing Unit 1 of the Deep RL course on Google Colab (Python 3.12), multiple cells fail due to dependency and platform incompatibilities, particularly around Box2D environments and the model publishing step.

Specifically:

  • gymnasium[box2d] fails to install on Colab with Python 3.12
  • Box2D environments such as LunarLander, BipedalWalker, and CarRacing raise ModuleNotFoundError: No module named 'Box2D'
  • box2d-py and pygame==2.1.3 fail to build from source
  • Several later cells implicitly assume Box2D availability, causing repeated failures even after earlier workarounds
  • The “Publish our trained model on the Hub” step fails with 403 Forbidden unless the user manually authenticates, but this is not clearly documented and Colab does not always expose “Tools → Secrets”

I was able to complete the unit by replacing the Box2D environments with CartPole-v1, which works correctly and still satisfies the learning objectives.

Please share your notebook link so that we can reproduce the error:

https://colab.research.google.com/github/huggingface/deep-rl-class/blob/master/notebooks/unit1/unit1.ipynb

Material

  • Did you use Google Colab?
    Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions