Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't find environment #35

Closed
mf093087 opened this issue Jan 3, 2023 · 2 comments
Closed

can't find environment #35

mf093087 opened this issue Jan 3, 2023 · 2 comments

Comments

@mf093087
Copy link

mf093087 commented Jan 3, 2023

Thanks a lot for providing such a nice framework to enable the job scheduling. However, when I tried to run your code with main.py and install the requirements. I found that some of the versions of the libraries didn't match. I spent a lot of time to match all the versions and now it seemed to work.

But I can't find the environment at all even if I refer to your answer here
#28. Based on your answers, I added these lines in main.py

gym.envs.register(
id='JSSEnv:jss-v1',
entry_point='JSSEnv:JSSEnv'
)

This is what I got.

/home/fan/anaconda3/bin/conda run -n JSSEnv-master --no-capture-output python /mnt/d/OneDrive - The University of Nottingham/ESR1/work/Job Shop scheduling/RL-Job-Shop-Scheduling/JSS/main.py

Starting Ray
<module 'tensorflow' from '/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/tensorflow/init.py'>
{'real_obs': array([[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 0., 0.]]), 'action_mask': array([ True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True,
True, False])}
wandb: Currently logged in as: univeristynottingham (use wandb login --relogin to force relogin)
wandb: wandb version 0.13.7 is available! To upgrade, please run:
wandb: $ pip install wandb --upgrade

wandb: Tracking run with wandb version 0.10.22
wandb: Syncing run legendary-lion-50
wandb: ⭐️ View project at https://wandb.ai/univeristynottingham/uncategorized
wandb: 🚀 View run at https://wandb.ai/univeristynottingham/uncategorized/runs/hyb4ba40
wandb: Run data is saved locally in /mnt/d/OneDrive - The University of Nottingham/ESR1/work/Job Shop scheduling/RL-Job-Shop-Scheduling/JSS/wandb/run-20230103_170136-hyb4ba40
wandb: Run wandb offline to turn off syncing.
2023-01-03 17:01:44,793 INFO trainer.py:2332 -- Your framework setting is 'tf', meaning you are using static-graph mode. Set framework='tf2' to enable eager execution with tf2.x. You may also then want to set eager_tracing=True in order to reach similar execution speed as with static-graph mode.
2023-01-03 17:01:44,794 WARNING deprecation.py:46 -- DeprecationWarning: simple_optimizer has been deprecated. This will raise an error in the future!
2023-01-03 17:01:44,795 WARNING deprecation.py:46 -- DeprecationWarning: metrics_smoothing_episodes has been deprecated. Use metrics_num_episodes_for_smoothing instead. This will raise an error in the future!
2023-01-03 17:01:44,795 WARNING ppo.py:386 -- train_batch_size (33000) cannot be achieved with your other settings (num_workers=16 num_envs_per_worker=4 rollout_fragment_length=704)! Auto-adjusting rollout_fragment_length to 515.
2023-01-03 17:01:44,795 INFO ppo.py:414 -- In multi-agent mode, policies will be optimized sequentially by the multi-GPU optimizer. Consider setting simple_optimizer=True if this doesn't work for you.
2023-01-03 17:01:44,795 INFO trainer.py:903 -- Current log_level is WARN. For more information, set 'log_level': 'INFO' / 'DEBUG' or use the -v and -vv flags.
(pid=5105)
(pid=5101)
(pid=5107)
(pid=5103)
(pid=5100)
(pid=5109)
(pid=5111)
(pid=5099)
(pid=5112)
(pid=5098)
(pid=5108)
(pid=5102)
(pid=5110)
(pid=5579)
(pid=5582)
(pid=5580)
(pid=5104)
(pid=5106)
(pid=5574)
(pid=5578)
(pid=5097)
(pid=5577)
(pid=5576)
(pid=5581)
(pid=5584)
(pid=5585)
(pid=5583)
(pid=5587)
(pid=5575)
(pid=5589)
(pid=5588)
(pid=5586)
(RolloutWorker pid=5576) 2023-01-03 17:01:53,202 ERROR worker.py:451 -- Exception raised in creation task: The actor died because of an error raised in its creation task, ray::RolloutWorker.init() (pid=5576, ip=172.30.112.110, repr=<ray.rllib.evaluation.rollout_worker.RolloutWorker object at 0x7f9485a6ce80>)
(RolloutWorker pid=5576) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 676, in make
(RolloutWorker pid=5576) return registry.make(id, **kwargs)
(RolloutWorker pid=5576) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 490, in make
(RolloutWorker pid=5576) versions = self.env_specs.versions(namespace, name)
(RolloutWorker pid=5576) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 220, in versions
(RolloutWorker pid=5576) self._assert_name_exists(namespace, name)
(RolloutWorker pid=5576) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 297, in _assert_name_exists
(RolloutWorker pid=5576) raise error.NameNotFound(message)
(RolloutWorker pid=5576) gym.error.NameNotFound: Environment jss doesn't exist.
(RolloutWorker pid=5576)
(RolloutWorker pid=5576) During handling of the above exception, another exception occurred:
(RolloutWorker pid=5576)
(RolloutWorker pid=5576) ray::RolloutWorker.init() (pid=5576, ip=172.30.112.110, repr=<ray.rllib.evaluation.rollout_worker.RolloutWorker object at 0x7f9485a6ce80>)
(RolloutWorker pid=5576) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/ray/rllib/evaluation/rollout_worker.py", line 506, in init
(RolloutWorker pid=5576) self.env = env_creator(copy.deepcopy(self.env_context))
(RolloutWorker pid=5576) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/ray/rllib/env/utils.py", line 56, in gym_env_creator
(RolloutWorker pid=5576) raise EnvError(ERR_MSG_INVALID_ENV_DESCRIPTOR.format(env_descriptor))
(RolloutWorker pid=5576) ray.rllib.utils.error.EnvError: The env string you provided ('jss-v1') is:
(RolloutWorker pid=5576) a) Not a supported/installed environment.
(RolloutWorker pid=5576) b) Not a tune-registered environment creator.
(RolloutWorker pid=5576) c) Not a valid env class string.
(RolloutWorker pid=5576)
(RolloutWorker pid=5576) Try one of the following:
(RolloutWorker pid=5576) a) For Atari support: pip install gym[atari] autorom[accept-rom-license].
(RolloutWorker pid=5576) For VizDoom support: Install VizDoom
(RolloutWorker pid=5576) (https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md) and
(RolloutWorker pid=5576) pip install vizdoomgym.
(RolloutWorker pid=5576) For PyBullet support: pip install pybullet.
(RolloutWorker pid=5576) b) To register your custom env, do from ray import tune; (RolloutWorker pid=5576) tune.register('[name]', lambda cfg: [return env obj from here using cfg]).
(RolloutWorker pid=5576) Then in your config, do config['env'] = [name].
(RolloutWorker pid=5576) c) Make sure you provide a fully qualified classpath, e.g.:
(RolloutWorker pid=5576) ray.rllib.examples.env.repeat_after_me_env.RepeatAfterMeEnv
(RolloutWorker pid=5584) 2023-01-03 17:01:53,224 ERROR worker.py:451 -- Exception raised in creation task: The actor died because of an error raised in its creation task, ray::RolloutWorker.init() (pid=5584, ip=172.30.112.110, repr=<ray.rllib.evaluation.rollout_worker.RolloutWorker object at 0x7f26b16a8e80>)
(RolloutWorker pid=5584) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 676, in make
(RolloutWorker pid=5584) return registry.make(id, **kwargs)
(RolloutWorker pid=5584) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 490, in make
(RolloutWorker pid=5584) versions = self.env_specs.versions(namespace, name)
(RolloutWorker pid=5584) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 220, in versions
(RolloutWorker pid=5584) self._assert_name_exists(namespace, name)
(RolloutWorker pid=5584) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 297, in _assert_name_exists
(RolloutWorker pid=5584) raise error.NameNotFound(message)
(RolloutWorker pid=5584) gym.error.NameNotFound: Environment jss doesn't exist.
(RolloutWorker pid=5584)
(RolloutWorker pid=5584) During handling of the above exception, another exception occurred:
(RolloutWorker pid=5584)
(RolloutWorker pid=5584) ray::RolloutWorker.init() (pid=5584, ip=172.30.112.110, repr=<ray.rllib.evaluation.rollout_worker.RolloutWorker object at 0x7f26b16a8e80>)
(RolloutWorker pid=5584) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/ray/rllib/evaluation/rollout_worker.py", line 506, in init
(RolloutWorker pid=5584) self.env = env_creator(copy.deepcopy(self.env_context))
(RolloutWorker pid=5584) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/ray/rllib/env/utils.py", line 56, in gym_env_creator
(RolloutWorker pid=5584) raise EnvError(ERR_MSG_INVALID_ENV_DESCRIPTOR.format(env_descriptor))
(RolloutWorker pid=5584) ray.rllib.utils.error.EnvError: The env string you provided ('jss-v1') is:
(RolloutWorker pid=5584) a) Not a supported/installed environment.
(RolloutWorker pid=5584) b) Not a tune-registered environment creator.
(RolloutWorker pid=5584) c) Not a valid env class string.
(RolloutWorker pid=5584)
(RolloutWorker pid=5584) Try one of the following:
(RolloutWorker pid=5584) a) For Atari support: pip install gym[atari] autorom[accept-rom-license].
(RolloutWorker pid=5584) For VizDoom support: Install VizDoom
(RolloutWorker pid=5584) (https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md) and
(RolloutWorker pid=5584) pip install vizdoomgym.
(RolloutWorker pid=5584) For PyBullet support: pip install pybullet.
(RolloutWorker pid=5584) b) To register your custom env, do from ray import tune; (RolloutWorker pid=5584) tune.register('[name]', lambda cfg: [return env obj from here using cfg]).
(RolloutWorker pid=5584) Then in your config, do config['env'] = [name].
(RolloutWorker pid=5584) c) Make sure you provide a fully qualified classpath, e.g.:
(RolloutWorker pid=5584) ray.rllib.examples.env.repeat_after_me_env.RepeatAfterMeEnv
(RolloutWorker pid=5579) 2023-01-03 17:01:53,340 ERROR worker.py:451 -- Exception raised in creation task: The actor died because of an error raised in its creation task, ray::RolloutWorker.init() (pid=5579, ip=172.30.112.110, repr=<ray.rllib.evaluation.rollout_worker.RolloutWorker object at 0x7f858809ce80>)
(RolloutWorker pid=5579) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 676, in make
(RolloutWorker pid=5579) return registry.make(id, **kwargs)
(RolloutWorker pid=5579) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 490, in make
(RolloutWorker pid=5579) versions = self.env_specs.versions(namespace, name)
(RolloutWorker pid=5579) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 220, in versions
(RolloutWorker pid=5579) self._assert_name_exists(namespace, name)
(RolloutWorker pid=5579) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 297, in _assert_name_exists
(RolloutWorker pid=5579) raise error.NameNotFound(message)
(RolloutWorker pid=5579) gym.error.NameNotFound: Environment jss doesn't exist.
(RolloutWorker pid=5579)
(RolloutWorker pid=5579) During handling of the above exception, another exception occurred:
(RolloutWorker pid=5579)
(RolloutWorker pid=5579) ray::RolloutWorker.init() (pid=5579, ip=172.30.112.110, repr=<ray.rllib.evaluation.rollout_worker.RolloutWorker object at 0x7f858809ce80>)
(RolloutWorker pid=5579) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/ray/rllib/evaluation/rollout_worker.py", line 506, in init
(RolloutWorker pid=5579) self.env = env_creator(copy.deepcopy(self.env_context))
(RolloutWorker pid=5579) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/ray/rllib/env/utils.py", line 56, in gym_env_creator
(RolloutWorker pid=5579) raise EnvError(ERR_MSG_INVALID_ENV_DESCRIPTOR.format(env_descriptor))
(RolloutWorker pid=5579) ray.rllib.utils.error.EnvError: The env string you provided ('jss-v1') is:
(RolloutWorker pid=5579) a) Not a supported/installed environment.
(RolloutWorker pid=5579) b) Not a tune-registered environment creator.
(RolloutWorker pid=5579) c) Not a valid env class string.
(RolloutWorker pid=5579)
(RolloutWorker pid=5579) Try one of the following:
(RolloutWorker pid=5579) a) For Atari support: pip install gym[atari] autorom[accept-rom-license].
(RolloutWorker pid=5579) For VizDoom support: Install VizDoom
(RolloutWorker pid=5579) (https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md) and
(RolloutWorker pid=5579) pip install vizdoomgym.
(RolloutWorker pid=5579) For PyBullet support: pip install pybullet.
(RolloutWorker pid=5579) b) To register your custom env, do from ray import tune; (RolloutWorker pid=5579) tune.register('[name]', lambda cfg: [return env obj from here using cfg]).
(RolloutWorker pid=5579) Then in your config, do config['env'] = [name].
(RolloutWorker pid=5579) c) Make sure you provide a fully qualified classpath, e.g.:
(RolloutWorker pid=5579) ray.rllib.examples.env.repeat_after_me_env.RepeatAfterMeEnv
(RolloutWorker pid=5582) 2023-01-03 17:01:53,322 ERROR worker.py:451 -- Exception raised in creation task: The actor died because of an error raised in its creation task, ray::RolloutWorker.init() (pid=5582, ip=172.30.112.110, repr=<ray.rllib.evaluation.rollout_worker.RolloutWorker object at 0x7f36879d4e50>)
(RolloutWorker pid=5582) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 676, in make
(RolloutWorker pid=5582) return registry.make(id, **kwargs)
(RolloutWorker pid=5582) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 490, in make
(RolloutWorker pid=5582) versions = self.env_specs.versions(namespace, name)
(RolloutWorker pid=5582) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 220, in versions
(RolloutWorker pid=5582) self._assert_name_exists(namespace, name)
(RolloutWorker pid=5582) File "/home/fan/anaconda3/envs/JSSEnv-master/lib/python3.10/site-packages/gym/envs/registration.py", line 297, in _assert_name_exists
(RolloutWorker pid=5582) raise error.NameNotFound(message)
(RolloutWorker pid=5582) gym.error.NameNotFound: Environment jss doesn't exist.
(RolloutWorker pid=5582)
(RolloutWorker pid=5582) During handling of the above exception, another exception occurred:
(RolloutWorker pid=5582)
(RolloutWorker pid=5582) ray::RolloutWorker.init() (pid=5582, ip=172.30.112.110, repr=

Process finished with exit code 1

@mf093087
Copy link
Author

mf093087 commented Jan 8, 2023

I found the environment, I use

def env_creator(env_config):
return JssEnv() # return an env instance
register_env("jss-v1", env_creator)

@ingambe
Copy link
Collaborator

ingambe commented Jan 14, 2023

For future reference:

def env_creator(env_config):
    return JssEnv() # return an env instance

register_env("jss-v1", env_creator)

@ingambe ingambe closed this as completed Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants