eugenevinitsky / sequential_social_dilemma_games

Repo for reproduction of sequential social dilemmas
MIT License
380 stars 134 forks source link

Difficulties with setup #170

Open eager-seeker opened 4 years ago

eager-seeker commented 4 years ago

Trying to follow the setup instructions through as per the README does not seem straightforward as things stand. (Mac OS, Mojave).

  1. Is there an instruction missing on creating a conda causal environment from the environment.yml? The python setup.py develop instructions given won't result in this will it?
  2. It is conda that's expected to be used to manage environments?

Assumingconda env create -n causal environment.yml needed to be run, the following issues then came up during setup:

  1. matplotlib version specified for the environment seem not compatible with the python install for the conda causal environment on the Mac:
    ImportError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

    Workaround: This is odd, as I've used matplotlib and import matplotlib.pyplot as plt without issues on other environments. I'm not 100% sure what the details of the backend issues are, but relaxing the version specified in the environment file, and upgrading matplotlib (3.1.3 at time of writing), seemed to resolve.

  2. The symlinks to @natashamjaques fork of ray seem incomplete, or at least the following errors occur when running tests:
    ImportError while importing test module '<my-local-source-path>/sequential_social_dilemma_games/tests/test_envs.py'.
    Hint: make sure your test modules/packages have valid Python names.
    Traceback:
    tests/test_envs.py:15: in <module>
    from social_dilemmas.envs.cleanup import CleanupEnv
    social_dilemmas/envs/cleanup.py:5: in <module>
    from social_dilemmas.envs.map_env import MapEnv, ACTIONS
    social_dilemmas/envs/map_env.py:8: in <module>
    from ray.rllib.env import MultiAgentEnv
    <my-user-directory>/anaconda3/envs/causal/lib/python3.6/site-packages/ray/rllib/__init__.py:11: in <module>
    from ray.rllib.evaluation.policy_graph import PolicyGraph
    ...
    <my-user-directory>/anaconda3/envs/causal/lib/python3.6/site-packages/ray/rllib/evaluation/tf_policy_graph.py:12: in <module>
    import ray.experimental.tf_utils
    E   ModuleNotFoundError: No module named 'ray.experimental.tf_utils'

I have been trying to add further module ray symlinks (e.g. for experimental) but it just seems to reveal more and more unresolvable dependencies. Are there any plans to integrate with a stable/supported release of ray instead of the fork? I assume there remain incompatibilities.

I would post a PR to update matplotlib if I could test the consequences. But I can't currently run tests.

May relate to https://github.com/eugenevinitsky/sequential_social_dilemma_games/issues/164, I'm not sure. That one seems to have different steps in setting up ray versions.

eager-seeker commented 4 years ago

Just an update... Adding the experimental directory from ray's rllib did seem to fix the tests, after starting from fresh. I could push up a PR to each, but would need to be granted the rights.

eugenevinitsky commented 4 years ago

Hi, so yes, it does seem the matplotlib version is bad. That's a good catch. Yes, you are expected to use the conda env. Unfortunately, as for the Ray version, there isn't a version of the causal code that I've 100% proven to work. There is a branch up that has an upgrade to Ray 0.7.6 (ppo_causal_fixes) which you're welcome to check out and try!