PARL
PARL copied to clipboard
No module named 'xparl_test'
Case
I tried to build a Remote Mujoco env wrapper, and write a class to pass env's data(mainly action_space & observation_space). But I got the following error.
- Dependencies are the same: Linux, parl=1.4
Error:
Code
import gym
import parl
class ActionSpace(object):
def __init__(self, low, high, shape=None):
super(ActionSpace, self).__init__()
self.low = low
self.high = high
self.shape = shape
@parl.remote_class
class RemoteEnv(object):
def __init__(self, env_name=None):
super(RemoteEnv, self).__init__()
self.env = gym.make(env_name)
self.action_space = ActionSpace(self.env.action_space.low,
self.env.action_space.high,
self.env.action_space.shape)
parl.connect('localhost')
env = RemoteEnv(env_name='HalfCheetah-v1')
action_dim = env.action_space.shape[0]
print(action_dim, max_action)
It can work in this way, but seems not to be convenient
import gym
import parl
@parl.remote_class
class RemoteEnv(object):
def __init__(self, env_name=None):
super(RemoteEnv, self).__init__()
class ActionSpace(object):
def __init__(self, low, high, shape=None):
super(ActionSpace, self).__init__()
self.low = low
self.high = high
self.shape = shape
self.env = gym.make(env_name)
self.action_space = ActionSpace(self.env.action_space.low,
self.env.action_space.high,
self.env.action_space.shape)
parl.connect('localhost:8080')
env = RemoteEnv(env_name='HalfCheetah-v1')
action_dim = env.action_space.shape[0]
print(action_dim)