vwxyzjn/cleanrl

numpy version issue with python 3.10

Closed this issue · 1 comments

Problem Description

The documentation says that it should work on Python >=3.7.1,<3.11. I can run and debug models using python 3.8.2 but not python 3.10.12).

Checklist

Current Behavior

I'm getting the following error:

ubuntu@ip-172-31-23-81:~/cleanrl$ python3 cleanrl/ppo.py --env-id CartPole-v1
/home/ubuntu/.local/lib/python3.10/site-packages/torch/utils/tensorboard/__init__.py:4: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if not hasattr(tensorboard, "__version__") or LooseVersion(
/home/ubuntu/.local/lib/python3.10/site-packages/torch/random.py:42: UserWarning: Failed to initialize NumPy: module compiled against API version 0x10 but this version of numpy is 0xe (Triggered internally at  /root/pytorch/torch/csrc/utils/tensor_numpy.cpp:68.)
  return default_generator.manual_seed(seed)
/home/ubuntu/.local/lib/python3.10/site-packages/gym/core.py:172: DeprecationWarning: WARN: Function `env.seed(seed)` is marked as deprecated and will be removed in the future. Please use `env.reset(seed=seed) instead.
  deprecation(
Traceback (most recent call last):
  File "/home/ubuntu/cleanrl/cleanrl/ppo.py", line 202, in <module>
    next_obs, reward, done, info = envs.step(action.cpu().numpy())
RuntimeError: Numpy is not available

Expected Behavior

python3 cleanrl/ppo.py --env-id CartPole-v1 should run successfully.

Possible Solution

upgrade numpy version to the latest (I validated it with 1.26.0) and it worked.
https://github.com/vwxyzjn/cleanrl/blob/master/requirements/requirements.txt#L35

Steps to Reproduce

  1. setup ubuntu latest version (e.g. Ubuntu 22.04.2 LTS). alternatively use IntelliJ on MacOs with python virtual environment
  2. install python3 and pip if not already installed (3.10.12 or 3.11)
  3. git clone the repository: git clone https://github.com/vwxyzjn/cleanrl.git && cd cleanrl
  4. install requirements: pip install -r requirements/requirements.txt
  5. run python3 cleanrl/ppo.py --env-id CartPole-v1
  6. you will get an error

Fixed in #424. Added CI for 3.9, 3.10