google-deepmind / meltingpot

A suite of test scenarios for multi-agent reinforcement learning.
Apache License 2.0
582 stars 118 forks source link

ModuleNotFoundError: No module named 'examples' #135

Closed theo-michel closed 1 year ago

theo-michel commented 1 year ago

Description: I am trying to get familiar with the Melting Pot environment in order to create my own environment. However, I encountered an issue while trying to run the rllib example provided in the repository.

Steps to reproduce:

  1. Clone the Melting Pot repository.
  2. Navigate to the root directory of Melting Pot: cd <meltingpot_root>
  3. Install the required dependencies for rllib: pip3 install -e .[rllib]
  4. Navigate to the rllib example directory: cd <meltingpot_root>/examples/rllib
  5. Run the self_play_train.py script: python3 self_play_train.py

Expected behavior: The self_play_train.py script should run successfully without any errors.

Actual behavior: When running the self_play_train.py script, I encounter the following error:

File ".../meltingpot/examples/rllib/self_play_train.py", line 24, in <module>
    from examples.rllib import utils
ModuleNotFoundError: No module named 'examples'

Additional information: It appears that the self_play_train.py script is unable to find the 'examples' module, leading to the ModuleNotFoundError.

Possible solution: A fix I found is running export PYTHONPATH=$(pwd) in the parent directory

Further improvements: I think it is not clear in the Readme that this is needed for the rllib example as well. Or maybe there is a more convenient fix

duenez commented 1 year ago

The examples are set up to be run from the meltingpot root directory, so instead of:

cd <meltingpot_root>/examples/rllib
python3 self_play_train.py

You should run with:

cd <meltingpot_root>
python3 examples/rllib/self_play_train.py

If that doesn't work either, you can also take a look at test-extras.sh for how we run it. The issue is fundamentally that we don't install the extras into your python directory, and we don't assume anything about your general dev setup. Instead, we provide an example that could be run from your usual project root.