facebookresearch / salina

a Lightweight library for sequential learning agents, including reinforcement learning
MIT License
426 stars 41 forks source link

Requirements not complete and unable to run examples #10

Closed AndreBiedenkapp closed 2 years ago

AndreBiedenkapp commented 2 years ago

I just cloned the repo and tried to run some of the provided examples. Unfortunately I couldn't run them as the requirements are not clear. I tried python 3.7 - 3.9 to see if it was an issue of the python version. For each I did the following:

For individual examples I first get ModuleNotFoundErrors. E.g., when running salina_examples/rl/a2c/mono_cpu/main.py I encounter the following errors: ModuleNotFoundError: No module named 'graphviz' and ModuleNotFoundError: No module named 'pandas' After fixing those I get ModuleNotFoundError: No module named 'salina_examples.rl.a2c'

Similarly, when trying to run salina_examples/rl/ppo_continuous/ppo.py I first encounter ModuleNotFoundError: No module named 'cv2' and after fixing it I get the following error:

Traceback (most recent call last):
  File "/home/biedenka/anaconda3/envs/salina-test/lib/python3.8/site-packages/gym/envs/registration.py", line 158, in spec
    return self.env_specs[id]
KeyError: 'Pendulum-v0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "salina_examples/rl/ppo_continuous/ppo.py", line 180, in main
    action_agent = instantiate_class(cfg.action_agent)
  File "/home/biedenka/anaconda3/envs/salina-test/lib/python3.8/site-packages/salina-1.0-py3.8.egg/salina/__init__.py", line 27, in instantiate_class
    return c(**d)
  File "/home/biedenka/anaconda3/envs/salina-test/lib/python3.8/site-packages/salina-1.0-py3.8.egg/salina_examples/rl/ppo_continuous/agents.py", line 92, in __init__
    env = instantiate_class(args["env"])
  File "/home/biedenka/anaconda3/envs/salina-test/lib/python3.8/site-packages/salina-1.0-py3.8.egg/salina/__init__.py", line 27, in instantiate_class
    return c(**d)
  File "/home/biedenka/anaconda3/envs/salina-test/lib/python3.8/site-packages/salina-1.0-py3.8.egg/salina_examples/rl/ppo_continuous/agents.py", line 33, in make_gym_env
    e = gym.make(env_args["env_name"])
  File "/home/biedenka/anaconda3/envs/salina-test/lib/python3.8/site-packages/gym/envs/registration.py", line 235, in make
    return registry.make(id, **kwargs)
  File "/home/biedenka/anaconda3/envs/salina-test/lib/python3.8/site-packages/gym/envs/registration.py", line 128, in make
    spec = self.spec(path)
  File "/home/biedenka/anaconda3/envs/salina-test/lib/python3.8/site-packages/gym/envs/registration.py", line 185, in spec
    raise error.DeprecatedEnv(
gym.error.DeprecatedEnv: Env Pendulum-v0 not found (valid versions include ['Pendulum-v1'])

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

which is caused by a recent change in gym. For reference see:

To me it looks like these are all dependency issues (and for the ModuleNotFoundError: No module named 'salina_examples.rl.a2c' it mightbe fixed by including an init.py in the folder). Could you please state the minimal version number for which salina works as well as the python version (more prominently than in the setup.py)?

ludc commented 2 years ago

Thanks for the comment. We will clean this quickly to provide the right dependencies.

ludc commented 2 years ago

The problem has been solved in PR #6 Please tell me if anything is still not working on your side

1) Create a new python env 2) Execute pip install -e . 3) You can test PPO through python salina/salina_examples/rl/ppo_continuous/ppo.py

AndreBiedenkapp commented 2 years ago

Thank you very much for the quick reply. Yes everything is now working :)