On a Linux PC, I am attempting to create a custom open AI Gym environment. I can get through all of the steps from a blog write up from medium.com including the pip install -e . but I get an error with the final product making the environment env = gym.make('BASoperator-v1.0')
The medium blog states this file directory is needed, my naming convention is this:
vavBox/ README.md setup.py vavBox/ __init__.py envs/ __init__.py vavBox.pyThis is my setup.py:
from setuptools import setup
setup(name='vavBox', version='0.0.1', install_requires=['gym']
) First init.py:
from gym.envs.registration import register
register( id='vavBox', entry_point='vavBox.envs:vavBox',
)2nd init.py in the env folder:
from vavBox.envs.vavBox import vavBoxThe pip install went fine. I can see that pip installed the 3rd party package. But, when I attempt to import the environment thru this script below:
import numpy as np
import pandas as pd
import time
import gym
import vavBox
env = gym.make('vavBox')I get an error, gym.error.Error: Attempted to register malformed environment ID: vavBox. (Currently all IDs must be of the form ^(?:[\w:-]+\/)?([\w:.-]+)-v(\d+)$.)
1 Answer
In vavBox/init.py the id should read:
from gym.envs.registration import register
register( id='vavBox-v0', entry_point='vavBox.envs:vavBox', )or something with a "-v[0-9]+" after it to match the regex