RL-Job-Shop-Scheduling icon indicating copy to clipboard operation
RL-Job-Shop-Scheduling copied to clipboard

Failed to run the code: JSSEnv not found

Open smita-09 opened this issue 4 years ago • 3 comments

First of all I would like to thank you for doing the implementation of the idea you proposed in your paper and also for such a real nice paper. Learnt a lot from it! I am doing research in similar area and your paper has been a great starting point.

I am using Ubuntu 21.10 and Python version 3.9 While running the code I found lot of errors while installing the packages listed in requirements.txt because of the dependencies and deprecated versions so and that makes sense because now lot of newer version of these packages are there and the older ones do no support so I tried installing the packages listed in requirements.txt by removing all the versions in there and it did install successfully.

But then somehow the JSSEnv is not available although I did install it.

Here is the error that I am getting and somehow I am stuck here, Any help will be appreciated alot.

wandb: Currently logged in as: smita09 (usewandb login --reloginto force relogin) wandb: Tracking run with wandb version 0.12.11 wandb: Run data is saved locally in /home/smita/RL-Job-Shop-Scheduling/JSS/wandb/run-20220304_054910-393en4ar wandb: Runwandb offlineto turn off syncing. wandb: Syncing run worldly-flower-21 wandb: ⭐️ View project at https://wandb.ai/smita09/RL-Job-Shop-Scheduling-JSS wandb: 🚀 View run at https://wandb.ai/smita09/RL-Job-Shop-Scheduling-JSS/runs/393en4ar E0304 05:49:15.560678575 29964 fork_posix.cc:70] Fork support is only compatible with the epoll1 and poll polling strategies E0304 05:49:15.955048134 29964 fork_posix.cc:70] Fork support is only compatible with the epoll1 and poll polling strategies 2022-03-04 05:49:17,754 INFO services.py:1374 -- View the Ray dashboard at http://127.0.0.1:8265 E0304 05:49:17.774863530 29964 fork_posix.cc:70] Fork support is only compatible with the epoll1 and poll polling strategies E0304 05:49:17.810299565 29964 fork_posix.cc:70] Fork support is only compatible with the epoll1 and poll polling strategies 2022-03-04 05:49:21,270 INFO trainer.py:2054 -- 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. 2022-03-04 05:49:21,281 WARNING deprecation.py:45 -- DeprecationWarning:simple_optimizerhas been deprecated. This will raise an error in the future! 2022-03-04 05:49:21,282 WARNING deprecation.py:45 -- DeprecationWarning:metrics_smoothing_episodeshas been deprecated. Usemetrics_num_episodes_for_smoothinginstead. This will raise an error in the future! 2022-03-04 05:49:21,282 WARNING deprecation.py:45 -- DeprecationWarning:metrics_smoothing_episodeshas been deprecated. Usemetrics_num_episodes_for_smoothinginstead. This will raise an error in the future! 2022-03-04 05:49:21,282 WARNING ppo.py:223 --train_batch_size(33000) cannot be achieved with your other settings (num_workers=2 num_envs_per_worker=4 rollout_fragment_length=704)! Auto-adjustingrollout_fragment_length` to 4125. 2022-03-04 05:49:21,282 INFO ppo.py:249 -- 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. 2022-03-04 05:49:21,282 INFO trainer.py:790 -- Current log_level is WARN. For more information, set 'log_level': 'INFO' / 'DEBUG' or use the -v and -vv flags. (pid=30192) (pid=30190) Traceback (most recent call last): File "/home/smita/second_env/lib/python3.9/site-packages/ray/rllib/agents/trainer.py", line 811, in setup self._init(self.config, self.env_creator) File "/home/smita/second_env/lib/python3.9/site-packages/ray/rllib/agents/trainer.py", line 923, in _init raise NotImplementedError NotImplementedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/smita/RL-Job-Shop-Scheduling/JSS/main.py", line 161, in train_func() File "/home/smita/RL-Job-Shop-Scheduling/JSS/main.py", line 148, in train_func trainer = PPOTrainer(config=config) File "/home/smita/second_env/lib/python3.9/site-packages/ray/rllib/agents/trainer.py", line 728, in init super().init(config, logger_creator, remote_checkpoint_dir, File "/home/smita/second_env/lib/python3.9/site-packages/ray/tune/trainable.py", line 122, in init self.setup(copy.deepcopy(self.config)) File "/home/smita/second_env/lib/python3.9/site-packages/ray/rllib/agents/trainer.py", line 826, in setup self.workers = self._make_workers( File "/home/smita/second_env/lib/python3.9/site-packages/ray/rllib/agents/trainer.py", line 1925, in _make_workers return WorkerSet( File "/home/smita/second_env/lib/python3.9/site-packages/ray/rllib/evaluation/worker_set.py", line 100, in init remote_spaces = ray.get(self.remote_workers( File "/home/smita/second_env/lib/python3.9/site-packages/ray/_private/client_mode_hook.py", line 105, in wrapper return func(*args, **kwargs) File "/home/smita/second_env/lib/python3.9/site-packages/ray/worker.py", line 1735, in get raise value ray.exceptions.RayActorError: The actor died because of an error raised in its creation task, ray::RolloutWorker.init() (pid=30190, ip=192.168.140.128) File "/home/smita/second_env/lib/python3.9/site-packages/gym/envs/registration.py", line 676, in make return registry.make(id, **kwargs) File "/home/smita/second_env/lib/python3.9/site-packages/gym/envs/registration.py", line 490, in make versions = self.env_specs.versions(namespace, name) File "/home/smita/second_env/lib/python3.9/site-packages/gym/envs/registration.py", line 220, in versions self._assert_name_exists(namespace, name) File "/home/smita/second_env/lib/python3.9/site-packages/gym/envs/registration.py", line 297, in _assert_name_exists raise error.NameNotFound(message) gym.error.NameNotFound: Environment JSSEnv:jss doesn't exist.

During handling of the above exception, another exception occurred:

ray::RolloutWorker.init() (pid=30190, ip=192.168.140.128) File "/home/smita/second_env/lib/python3.9/site-packages/ray/rllib/evaluation/rollout_worker.py", line 460, in init self.env = env_creator(copy.deepcopy

wandb: Waiting for W&B process to finish... (failed 1). Press Control-C to abort syncing. wandb:
wandb: Synced worldly-flower-21: https://wandb.ai/smita09/RL-Job-Shop-Scheduling-JSS/runs/393en4ar wandb: Synced 5 W&B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s) wandb: Find logs at: ./wandb/run-20220304_054910-393en4ar/logs`

Thanks in Advance! Have a great day! :)

smita-09 avatar Mar 04 '22 13:03 smita-09

Hi @smita-09

Thank you for your kind words :)

It seems there is some issue with the registration of the environment. Could you try to add those lines at the beginning of the main file:

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

This should register the custom environment and point the id to the correct entry point.

Example of the full script:

import gym

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

env = gym.make('JSSEnv:jss-v1')
print(env.reset())

I hope this will fix your issue :)

ingambe avatar Mar 05 '22 17:03 ingambe

First of all I would like to thank you for doing the implementation of the idea you proposed in your paper and also for such a real nice paper. Learnt a lot from it! I am doing research in similar area and your paper has been a great starting point. I am using the python=3.6 and running in Windows ,but when i run it show ModuleNotFoundError: No module named 'tree' . but i have installed it . what should i do

hailinw7 avatar Sep 23 '22 08:09 hailinw7

Hi @smita-09

Thank you for your kind words :)

It seems there is some issue with the registration of the environment. Could you try to add those lines at the beginning of the main file:

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

This should register the custom environment and point the id to the correct entry point.

Example of the full script:

import gym

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

env = gym.make('JSSEnv:jss-v1')
print(env.reset())

I hope this will fix your issue :)

I tried, it didn't work, I have the same issues..

mf093087 avatar Jan 03 '23 16:01 mf093087