alexfrom0815 / Online-3D-BPP-DRL

This repository contains the implementation of paper Online 3D Bin Packing with Constrained Deep Reinforcement Learning.
292 stars 66 forks source link

gym registration #3

Closed strongteck closed 3 years ago

strongteck commented 3 years ago

Hello,

I tried to register the "envs/Bpp-v0" evirionment by adding the following code in file ./Online-3D-BPP-DRL/envs/bpp0/init.py, but I am getting errors as "gym.error.UnregisteredEnv: No registered env with id: Bpp-v0".

Could you please advise?

Thank you.


from gym.envs.registration import register register( id='Bpp-v0', entry_point='bpp0.bin3D:PackingGame', )

alexfrom0815 commented 3 years ago

Hello, I’m not sure what you have encountered here, but I think you can try the following steps:

  1. Install gym and find the package path of your gym, you type print(gym.__path__) in your python interpreter to find it.
  2. Create a folder named ‘user’ under 'your gym path/envs/' and move the 'bpp0' folder into 'your gym path/envs/user', the final path should be 'your gym path/envs/user/bpp0'
  3. Add registration to 'your gym path/envs/__init__.py', The newly added content should be: register( id='Bpp-v0', entry_point='gym.envs.user.bpp0:PackingGame', )

This is my solution, maybe not so elegant, but in my experience it works well, I hope it can solve your problem!

Best wishes!

strongteck commented 3 years ago

That perfectly solves the problem! Many thanks for help.

Ultraopxt commented 3 years ago

Hello, I’m not sure what you have encountered here, but I think you can try the following steps:

  1. Install gym and find the package path of your gym, you type print(gym.__path__) in your python interpreter to find it.
  2. Create a folder named ‘user’ under 'your gym path/envs/' and move the 'bpp0' folder into 'your gym path/envs/user', the final path should be 'your gym path/envs/user/bpp0'
  3. Add registration to 'your gym path/envs/__init__.py', The newly added content should be: register( id='Bpp-v0', entry_point='gym.envs.user.bpp0:PackingGame', )

This is my solution, maybe not so elegant, but in my experience it works well, I hope it can solve your problem!

Best wishes!

Hello, I have followed your steps but got the following error:

AttributeError: module 'gym.envs.user.bpp0' has no attribute 'PackingGame'

Any helps? Many thanks.

F2Wang commented 3 years ago

Hello, I’m not sure what you have encountered here, but I think you can try the following steps:

  1. Install gym and find the package path of your gym, you type print(gym.__path__) in your python interpreter to find it.
  2. Create a folder named ‘user’ under 'your gym path/envs/' and move the 'bpp0' folder into 'your gym path/envs/user', the final path should be 'your gym path/envs/user/bpp0'
  3. Add registration to 'your gym path/envs/__init__.py', The newly added content should be: register( id='Bpp-v0', entry_point='gym.envs.user.bpp0:PackingGame', )

This is my solution, maybe not so elegant, but in my experience it works well, I hope it can solve your problem! Best wishes!

Hello, I have followed your steps but got the following error:

AttributeError: module 'gym.envs.user.bpp0' has no attribute 'PackingGame'

Any helps? Many thanks.

I have the same problem, have you found a solution yet?

Ultraopxt commented 3 years ago

Hello, I’m not sure what you have encountered here, but I think you can try the following steps:

  1. Install gym and find the package path of your gym, you type print(gym.__path__) in your python interpreter to find it.
  2. Create a folder named ‘user’ under 'your gym path/envs/' and move the 'bpp0' folder into 'your gym path/envs/user', the final path should be 'your gym path/envs/user/bpp0'
  3. Add registration to 'your gym path/envs/__init__.py', The newly added content should be: register( id='Bpp-v0', entry_point='gym.envs.user.bpp0:PackingGame', )

This is my solution, maybe not so elegant, but in my experience it works well, I hope it can solve your problem! Best wishes!

Hello, I have followed your steps but got the following error: AttributeError: module 'gym.envs.user.bpp0' has no attribute 'PackingGame' Any helps? Many thanks.

I have the same problem, have you found a solution yet?

Not yet.

alexfrom0815 commented 3 years ago

Hello, I’m not sure what you have encountered here, but I think you can try the following steps:

  1. Install gym and find the package path of your gym, you type print(gym.__path__) in your python interpreter to find it.
  2. Create a folder named ‘user’ under 'your gym path/envs/' and move the 'bpp0' folder into 'your gym path/envs/user', the final path should be 'your gym path/envs/user/bpp0'
  3. Add registration to 'your gym path/envs/__init__.py', The newly added content should be: register( id='Bpp-v0', entry_point='gym.envs.user.bpp0:PackingGame', )

This is my solution, maybe not so elegant, but in my experience it works well, I hope it can solve your problem! Best wishes!

Hello, I have followed your steps but got the following error:

AttributeError: module 'gym.envs.user.bpp0' has no attribute 'PackingGame'

Any helps? Many thanks.

Sorry, I am unable to determine the cause of this error (gym installation or 'Bpp-v0' registration) due to insufficient information, but I can provide a debugging suggestion.

You can change the variable value of 'env_name' in config.py from 'Bpp-v0' to gym's original environment, such as 'CartPole-v0', (this environment is also registered in 'your gym path/envs/__init__. py'). If the environment of 'CartPole-v0' cannot be loaded, then there is a problem with the installation of gym. Otherwise, the problem lies in the registration of the environment of 'Bpp-v0'. In this case, you can also compare the registration format of the environment 'CartPole-v0' under 'your gym path/envs/__init__. py' to check whether your 'Bpp-v0' is registered correctly. Good luck!

Ultraopxt commented 3 years ago

Hello, I’m not sure what you have encountered here, but I think you can try the following steps:

  1. Install gym and find the package path of your gym, you type print(gym.__path__) in your python interpreter to find it.
  2. Create a folder named ‘user’ under 'your gym path/envs/' and move the 'bpp0' folder into 'your gym path/envs/user', the final path should be 'your gym path/envs/user/bpp0'
  3. Add registration to 'your gym path/envs/__init__.py', The newly added content should be: register( id='Bpp-v0', entry_point='gym.envs.user.bpp0:PackingGame', )

This is my solution, maybe not so elegant, but in my experience it works well, I hope it can solve your problem! Best wishes!

Hello, I have followed your steps but got the following error: AttributeError: module 'gym.envs.user.bpp0' has no attribute 'PackingGame' Any helps? Many thanks.

Sorry, I am unable to determine the cause of this error (gym installation or 'Bpp-v0' registration) due to insufficient information, but I can provide a debugging suggestion.

You can change the variable value of 'env_name' in config.py from 'Bpp-v0' to gym's original environment, such as 'CartPole-v0', (this environment is also registered in 'your gym path/envs/__init__. py'). If the environment of 'CartPole-v0' cannot be loaded, then there is a problem with the installation of gym. Otherwise, the problem lies in the registration of the environment of 'Bpp-v0'. In this case, you can also compare the registration format of the environment 'CartPole-v0' under 'your gym path/envs/__init__. py' to check whether your 'Bpp-v0' is registered correctly. Good luck!

Many thanks

F2Wang commented 3 years ago

Hello, I’m not sure what you have encountered here, but I think you can try the following steps:

  1. Install gym and find the package path of your gym, you type print(gym.__path__) in your python interpreter to find it.
  2. Create a folder named ‘user’ under 'your gym path/envs/' and move the 'bpp0' folder into 'your gym path/envs/user', the final path should be 'your gym path/envs/user/bpp0'
  3. Add registration to 'your gym path/envs/__init__.py', The newly added content should be: register( id='Bpp-v0', entry_point='gym.envs.user.bpp0:PackingGame', )

This is my solution, maybe not so elegant, but in my experience it works well, I hope it can solve your problem! Best wishes!

Hello, I have followed your steps but got the following error: AttributeError: module 'gym.envs.user.bpp0' has no attribute 'PackingGame' Any helps? Many thanks.

Sorry, I am unable to determine the cause of this error (gym installation or 'Bpp-v0' registration) due to insufficient information, but I can provide a debugging suggestion. You can change the variable value of 'env_name' in config.py from 'Bpp-v0' to gym's original environment, such as 'CartPole-v0', (this environment is also registered in 'your gym path/envs/__init__. py'). If the environment of 'CartPole-v0' cannot be loaded, then there is a problem with the installation of gym. Otherwise, the problem lies in the registration of the environment of 'Bpp-v0'. In this case, you can also compare the registration format of the environment 'CartPole-v0' under 'your gym path/envs/__init__. py' to check whether your 'Bpp-v0' is registered correctly. Good luck!

Many thanks

Hi, don't know if you figured out the issue, for me I should have copied bpp0 folder to under Online-3D-BPP-DRL/envs to gym path/envs/user/bpp0, while I only created a new folder under that path and put an init file in there...

strongteck commented 3 years ago

Hello, I’m not sure what you have encountered here, but I think you can try the following steps:

  1. Install gym and find the package path of your gym, you type print(gym.__path__) in your python interpreter to find it.
  2. Create a folder named ‘user’ under 'your gym path/envs/' and move the 'bpp0' folder into 'your gym path/envs/user', the final path should be 'your gym path/envs/user/bpp0'
  3. Add registration to 'your gym path/envs/__init__.py', The newly added content should be: register( id='Bpp-v0', entry_point='gym.envs.user.bpp0:PackingGame', )

This is my solution, maybe not so elegant, but in my experience it works well, I hope it can solve your problem! Best wishes!

Hello, I have followed your steps but got the following error: AttributeError: module 'gym.envs.user.bpp0' has no attribute 'PackingGame' Any helps? Many thanks.

Sorry, I am unable to determine the cause of this error (gym installation or 'Bpp-v0' registration) due to insufficient information, but I can provide a debugging suggestion. You can change the variable value of 'env_name' in config.py from 'Bpp-v0' to gym's original environment, such as 'CartPole-v0', (this environment is also registered in 'your gym path/envs/__init__. py'). If the environment of 'CartPole-v0' cannot be loaded, then there is a problem with the installation of gym. Otherwise, the problem lies in the registration of the environment of 'Bpp-v0'. In this case, you can also compare the registration format of the environment 'CartPole-v0' under 'your gym path/envs/__init__. py' to check whether your 'Bpp-v0' is registered correctly. Good luck!

Many thanks

Hi, don't know if you figured out the issue, for me I should have copied bpp0 folder to under Online-3D-BPP-DRL/envs to gym path/envs/user/bpp0, while I only created a new folder under that path and put an init file in there...

Make sure gym is well installed before you dig deeper to the copy folder stuff by testing it with a standard environment (say 'CartPole-v0' as pointed by alex).