stefan-jansen / machine-learning-for-trading

Code for Machine Learning for Algorithmic Trading, 2nd edition.
https://ml4trading.io
12.57k stars 4.03k forks source link

Chapter 22_deep_reinforcement_learning Google Colab Python 3.10 03_lunar_lander #318

Open martin0 opened 6 months ago

martin0 commented 6 months ago

Describe the bug A brief description of the bug and in which notebook/script it lives. 03_lunar_lander_deep_q_learning.ipynb env = gym.make('LunarLander-v2') ModuleNotFoundError: No module named 'Box2D' DependencyNotInstalled: box2D is not installed, run pip install gym[box2d]

so...

create cell !pip install gym[box2d] fails to install

To Reproduce

Steps to reproduce the behavior: Open notebook in Google Colab run it see first error take corrective action (run pip install gym[box2d]) see second error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. Requirement already satisfied: gym[box2d] in /usr/local/lib/python3.10/dist-packages (0.25.2) Requirement already satisfied: numpy>=1.18.0 in /usr/local/lib/python3.10/dist-packages (from gym[box2d]) (1.23.5) Requirement already satisfied: cloudpickle>=1.2.0 in /usr/local/lib/python3.10/dist-packages (from gym[box2d]) (2.2.1) Requirement already satisfied: gym-notices>=0.0.4 in /usr/local/lib/python3.10/dist-packages (from gym[box2d]) (0.0.8) Collecting box2d-py==2.3.5 (from gym[box2d]) Downloading box2d-py-2.3.5.tar.gz (374 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 374.4/374.4 kB 8.6 MB/s eta 0:00:00 Preparing metadata (setup.py) ... done Collecting pygame==2.1.0 (from gym[box2d]) Downloading pygame-2.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.3/18.3 MB 52.5 MB/s eta 0:00:00 Collecting swig==4.* (from gym[box2d]) Downloading swig-4.1.1.post1-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.8 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 87.8 MB/s eta 0:00:00 Building wheels for collected packages: box2d-py error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. Building wheel for box2d-py (setup.py) ... error ERROR: Failed building wheel for box2d-py Running setup.py clean for box2d-py Failed to build box2d-py ERROR: Could not build wheels for box2d-py, which is required to install pyproject.toml-based projects

Environment If you are not using the latest version of the Docker imag: Google Colab running python 3.10 pip list as per the attached file piplist.txt

Additional context Add any other context about the problem here.