gabrielgarza / openai-gym-policy-gradient

Reinforcement Learning using Policy Gradient to solve OpenAI Gym games
111 stars 32 forks source link

What libraries are required? #2

Open mdavis-xyz opened 5 years ago

mdavis-xyz commented 5 years ago

Can you please add a requirements.txt or similar?

I'm trying to run this and python throws an error because it doesn't know the library policy_gradient. I can't find any similarly named library on pypi.

What library is that contained in?

parthvadhadiya commented 5 years ago

@mlda065 policy_gradient.py is already there in a repo. clone again and run.

mdavis-xyz commented 5 years ago

Ok, so I'm trying again and it's still not straightforward.

The README says to install gym. So I run

pip install gym

It also says to run

pip install -e '.[box2d]'

But that command fails. I've never seen that notation before. pip install box2d also fails. What is that command supposed to do?

So I can't run the lunar_lander example.

I try python run_cartpole.py. That fails because I don't have tensorflow installed. The README should say that you need to install tensorflow as well as gym.

pip install tensorflow
python run_cartpole.py

Now it fails because I don't have matplotlib installed. The README should say that you need to install matplotlib as well as gym and tensorflow.

pip install matplotlib
python run_cartpole.py

Now it fails because I don't have tkinter installed.

pip install tkinter
pip install tk
pip install ttk

Those commands all fail. I can't figure out how to install this dependency. This is the reason why a requirements.txt file would be useful.

Once I figure out how to install the dependencies get both demos working, I'll submit a pull request to fix the README and add a requirements.txt file.

So how can I get the demos working?

gabrielgarza commented 5 years ago

@mlda065 apologies for not including a requirements.txt. Could you try following the tutorial/readme here? https://github.com/openai/gym#what-s-new and here https://gym.openai.com/docs/

gabrielgarza commented 5 years ago

Let me know if you are able to run those demos

mdavis-xyz commented 5 years ago

There are 2 solutions to get it working:

  1. (link) Modify the scripts to say:
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt

2.

apt-get install python3-tk

I don't know what the 'agg' thing really is. But it seems like a nicer solution than an apt dependency. Shall I submit a pull request with option 1, or option 2?

In addition to having requirements.txt

gym
tensorflow
matplotlib

Also, there's a typo in the README, it says "carpole" not "cartpole".

And the README should be modified to state that the funny pip install command for box2d should be run inside the cloned gym repo.