google-research / football

Check out the new game server:
https://research-football.dev
Apache License 2.0
3.28k stars 1.27k forks source link

In non-docker on Ubuntu 20.04, can't run ppo2: no module named 'baselines.common.models' #350

Open jecompton opened 1 year ago

jecompton commented 1 year ago

Since the docker builds aren't working, I was able to install GRF on my native Ubuntu 20.04 following the docs on this site. There were two modules that I had to pip install that weren't mentioned: six and baselines.

I pip installed those, and then verified it ran with python -m gfootball.play_game --action_set=full. The field came up fine with all the players running around and such.

However, when I tried to run the ppo2 training with python -m gfootball.examples.run_ppo2 --level=academy_empty_goal_close, I got this error: ModuleNotFoundError: No module named 'baselines.common.models

I looked around on the web, but couldn't figure out which version of baselines might have that. I tried a few, but no luck.

jecompton commented 1 year ago

I got this to work, no thanks to the maintainers. But hey, I can't complain! I got it to work, and it's far easier for me to fight with python dependency hell than it is to write an amazing football RL framework.

In case this helps someone, Here's what I did.

  1. DO NOT do pip install --upgrade pip setuptools psutil wheel. There is some weird regression that can come up where the setup.py in the gym version dies if you do this.
  2. pip install gfootball
  3. Install the other deps they assumed you had but probably don't in a fresh env: pip install six
  4. Next, you need to install the TF deps for GPU training and such: pip install tensorflow-gpu==1.15.5 dm-sonnet==1.36 psutil. DO NOT do TF 2.x.
  5. If it gripes about cloudpickle, just make sure you are using 1.1.1. that works with me despite it saying it is not compatible. Do pip install -v 'cloudpickle==1.1.1' to make sure you're on the correct version.
  6. Install baselines: pip install git+https://github.com/openai/baselines.git@master
  7. Downgrade your protobufs for the python env with pip -v 'protobuf==3.20.3'.
  8. Verify PPO2 training works: python3 -m gfootball.examples.run_ppo2 --dump_full_episodes=True --render=True

If this doesn't work, try the dockers, but if you're here, you probably tried them first and failed. Good luck!