registering a new environment
See original GitHub issueIs there any way to specify a custom environment on the command line, e.g. as a fully-qualified name or lambda? Using the name of a custom environment as is leads to this error:
python -m spinup.run ppo --hid "[32,32]" --env Banana-v0 --exp_name banana --gamma 0.999
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/srv/s/aima/spinningup/spinningup/spinup/run.py", line 231, in <module>
parse_and_execute_grid_search(cmd, args)
File "/srv/s/aima/spinningup/spinningup/spinup/run.py", line 156, in parse_and_execute_grid_search
assert env_name in valid_envs, err_msg
AssertionError:
Banana-v0 is not registered with Gym.
Recommendations:
* Check for a typo (did you include the version tag?)
* View the complete list of valid Gym environments at
https://gym.openai.com/envs/
I can get past that point in the code by throwing an import statement in run.py for my custom environment import gym_banana
, but then I run in to this later on:
…
gym.error.UnregisteredEnv: No registered env with id: Banana-v0
Traceback (most recent call last):
File "/home/neal/Envs/rl2/lib/python3.6/site-packages/gym/envs/registration.py", line 159, in spec
return self.env_specs[id]
KeyError: 'Banana-v0'
...
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/srv/s/aima/spinningup/spinningup/spinup/run.py", line 231, in <module>
parse_and_execute_grid_search(cmd, args)
File "/srv/s/aima/spinningup/spinningup/spinup/run.py", line 163, in parse_and_execute_grid_search
eg.run(algo, **run_kwargs)
File "/srv/s/aima/spinningup/spinningup/spinup/utils/run_utils.py", line 546, in run
data_dir=data_dir, datestamp=datestamp, **var)
File "/srv/s/aima/spinningup/spinningup/spinup/utils/run_utils.py", line 171, in call_experiment
subprocess.check_call(cmd, env=os.environ)
File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/neal/Envs/rl2/bin/python', '/srv/s/aima/spinningup/spinningup/spinup/utils/run_entrypoint.py', 'eJyNUs9v0zAUdpquywYDxNAQO03i0gnR7oI4MIZEJThE2mFwRZZbu4mJ44TYLgxpEtJ+tJMsLntw4X/izl/BkSsvzdiAC8RK/N7nfH7fZ78P7U9HIZk//vZIFY6XcpQp0fstBn+NjqVSdOz0yMpCwxl0U+Kv05xlgppMNEsII7pCh04qKzW1+6VAzEeDgouXdXIMe9CNyXyE8ergGQ9mraxTbfEWJ4qcYsaDO+SUTMk0GLd4yNtHEWIL26ReeUxsMAsPg4DM2mNEPmLEyQsC3V0fCT2hmuUCYpIu/SrSwiLLs+A1mZHDAH/cPQbfrlWjlE3/qG+qSd/0mcxZ35RSa6kTV/4d4uSsVKZfOU3nUa/cR1vbiuVDznYg/jIgkF7xYbKfwwlsWrTpH4wYHpl4V4pK5kLb3rYqEDI7PZs6ndFSOXOJXezlO7WRsQYL6aqP8lLScVFl9bbpDb98yYX48+AaaUVBPW4GnTAKkZy9ZVViwC9ql9NR6cAvzCkwRYHp6gnU2uLwAPM9OICuX0xUMUQJmKTrfq3x22tc1sVtUeBiun4GxkdcjJlT1sCub3M5skjynbzgrm6SP7kXZ4Xdg71kXCXohCknDLyCbl15IWF5zuD5k+8/vn5bm97DA1x6yjSO+5Mt8EtsRM/dYJWrqeRcaGrk+2aHeCPeEMa3jRAcr9yvqCJJRHVJ6frlwtnSWcplBf7hv++aM8v6w7mC84kaFBLhHTad5TsNDM7Fgb917peppMCOKIv6BR/W3zMQPnrjmGp4d/+jF8DZvd5P3BROIA==']' returned non-zero exit status 1.
so evidently I need a more robust way to get it registered.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:18 (3 by maintainers)
Top Results From Across the Web
Need to register new environment | OutSystems
Each new environment requires it own license file. To request a new license for your new environment you can follow these steps for...
Read more >How can I register a custom environment in OpenAI's gym?
Place myenv.py file in gym/gym/envs/classic_control · Add to __init__.py (located in the same folder). from gym.envs.classic_control.myenv import ...
Read more >Environment - Federal Register
Suggested Environment Searches. Endangered & Threatened Species. 817 documents in the last year. The Endangered Species Act is designed to protect critically ...
Read more >I am a new company. How do I register with the EPA?
Contact Us to ask a question, provide feedback, or report a problem. Last updated on August 26, 2022. United States Environmental Protection Agency ......
Read more >Environmental Registry: Registration Process - S&P Global
Environmental Registry: Registration Process · Read the Environmental Registry Terms & Conditions · Read the Environmental Registry Privacy Policy · Complete the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@alitk I am using my own run script and using the experiments API
here’s a minimal example: https://gist.github.com/krishpop/f4b2aa8d60d7b22bce8c258fd68ab11c
My solution to this problem was doing the following: Passing env_fn to the experiment as
custom env module
is responsible for registering the environment when loaded. Importing this module in theenv_fn
takes care of making sure the imports are done by the subprocesses.