title: Custom environments for Gym Error: Cannot re-register id
body: <p>I want to create my own Gym environment. I have followed the steps explained in here: <a href="https://github.com/openai/gym/blob/master/docs/creating-environments.md" rel="nofollow noreferrer">https://github.com/openai/gym/blob/master/docs/creating-environments.md</a>. Based on their suggestion, I created the environment (link:<a href="https://drive.google.com/open?id=1RmcSBZYKCARaNsdlOsACrk9ls8snqxlj" rel="nofollow noreferrer">https://drive.google.com/open?id=1RmcSBZYKCARaNsdlOsACrk9ls8snqxlj</a> ). After installing and running the environment is created and displays the print out "Created, Step". But, when I had again pressed the 'Run' button (spyder ide:python3.7) it showed me the "Error: Cannot re-register id: foo-v0". The problem would disapper temporarily, if I press 'Restart kernel' button. But again 'Run' would show the same error. Please help me to solve this problem.</p>
  
  <pre><code>runfile('F:/gym-foo/a.py', wdir='F:/gym-foo')
  Created
  Step
  
  runfile('F:/gym-foo/a.py', wdir='F:/gym-foo')
  Reloaded modules: gym_foo, gym_foo.envs, gym_foo.envs.foo_env
  Traceback (most recent call last):
  
    File "F:\gym-foo\a.py", line 3, in &lt;module&gt;
      env = gym.make('gym_foo:foo-v0')
  
    File "C:\Users\nasif\anaconda3\lib\site-packages\gym\envs\registration.py", line 142, in make
      return registry.make(id, **kwargs)
  
    File "C:\Users\nasif\anaconda3\lib\site-packages\gym\envs\registration.py", line 86, in make
      spec = self.spec(path)
  
    File "C:\Users\nasif\anaconda3\lib\site-packages\gym\envs\registration.py", line 106, in spec
      importlib.import_module(mod_name)
  
    File "C:\Users\nasif\anaconda3\lib\importlib\__init__.py", line 127, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
  
    File "&lt;frozen importlib._bootstrap&gt;", line 1006, in _gcd_import
  
    File "&lt;frozen importlib._bootstrap&gt;", line 983, in _find_and_load
  
    File "&lt;frozen importlib._bootstrap&gt;", line 967, in _find_and_load_unlocked
  
    File "&lt;frozen importlib._bootstrap&gt;", line 677, in _load_unlocked
  
    File "&lt;frozen importlib._bootstrap_external&gt;", line 728, in exec_module
  
    File "&lt;frozen importlib._bootstrap&gt;", line 219, in _call_with_frames_removed
  
    File "F:\gym-foo\gym_foo\__init__.py", line 5, in &lt;module&gt;
      entry_point='gym_foo.envs:FooEnv',
  
    File "C:\Users\nasif\anaconda3\lib\site-packages\gym\envs\registration.py", line 139, in register
      return registry.register(id, **kwargs)
  
    File "C:\Users\nasif\anaconda3\lib\site-packages\gym\envs\registration.py", line 132, in register
      raise error.Error('Cannot re-register id: {}'.format(id))
  
  Error: Cannot re-register id: foo-v0
  </code></pre>