Search code examples
ropenai-gym

Setting gym enviroment locally


I try to run the example for gym package

Here are the line until the problem:

library(gym)

remote_base <- "http://127.0.0.1:5000"
client <- create_GymClient(remote_base)

# Create environment
env_id <- "CartPole-v0"
instance_id <- env_create(client, env_id)

The error is this:

Error in curl::curl_fetch_memory(url, handle = handle) : 
  Failed to connect to 127.0.0.1 port 5000: Connection refused

How is it possible to fix it?

I installed the gym package without any problem


Solution

  • I think you'll need to start the server in a separate terminal. Try

    python gym_http_server.py
    

    as described in the documentation on GitHub.