ElegantRL
ElegantRL copied to clipboard
The assets data need to be packaged
Bugs
When I tested the Isaac tutorial with elegantRL (use this code the author mentioned in this issue). I found that neither the config files nor the asset files can be loaded without modifying the source code of ElegantRL. The error is shown as follows
config files error
Traceback (most recent call last):
File "/home/ubuntu/Github/Knowledge-Universe/Robotics/Roadmap-for-robot-science/rofunc/lfd/rl/envs/curi_env.py", line 96, in <module>
demo(task)
File "/home/ubuntu/Github/Knowledge-Universe/Robotics/Roadmap-for-robot-science/rofunc/lfd/rl/envs/curi_env.py", line 45, in demo
env = build_env(env_func=env_func, env_args=env_args)
File "/home/ubuntu/anaconda3/envs/pytorch/lib/python3.8/site-packages/elegantrl/train/config.py", line 214, in build_env
env = env_func(**kwargs_filter(env_func.__init__, env_args.copy()))
File "/home/ubuntu/anaconda3/envs/pytorch/lib/python3.8/site-packages/elegantrl/envs/IsaacGym.py", line 63, in __init__
task_config = load_task_config(env_name)
File "/home/ubuntu/anaconda3/envs/pytorch/lib/python3.8/site-packages/elegantrl/envs/utils/config_utils.py", line 23, in load_task_config
with open(config_filename) as config_file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/Github/Knowledge-Universe/Robotics/Roadmap-for-robot-science/rofunc/lfd/rl/envs/./elegantrl/envs/isaac_configs/Ant.yaml'
asset files error
[Error] [carb.gym.plugin] *** Failed to load '/home/ubuntu/anaconda3/envs/pytorch/lib/python3.8/site-packages/elegantrl/envs/isaac_tasks/../isaac_assets/mjcf/nv_ant.xml'
[Error] [carb.gym.plugin] *** Failed to load 'nv_ant.xml' from '/home/ubuntu/anaconda3/envs/pytorch/lib/python3.8/site-packages/elegantrl/envs/isaac_tasks/../isaac_assets/mjcf'
Analysis
Since your package on PYPI has not been updated for a while, I installed the elegantRL via source codes. However, I found that the assets folder has not been installed via pip3 install .. This might be because only .py files will be packaged via setup.py.
Besides, the os.getcwd cannot return the path of the package, but return the path of the user's project.
# envs/utils/config_utils.py Line 20
config_root = os.path.join(os.getcwd(), "./elegantrl/envs/isaac_configs")
The asset_root path shares the same issue.
# envs/isaac_tasks/ant.py Line 175-177
asset_root = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "../isaac_assets"
)
Suggestion
To contain the non-py files while installing, you need to write a MANIFEST.in file to point out the path of data. Here is an example of my package. And then modify the setup.py as
include_package_data=True,
More suggestion
Maybe you can find the installation path of your package automatically by these following codes
if elegantrl_path == "":
if not hasattr(elegantrl, "__path__"):
raise RuntimeError("elegantrl package is not installed")
elegantrl_path = list(elegantrl.__path__)[0]
config_path = os.path.join(elegantrl_path, "cfg")
your plugins is not in this path.check it it may be for os.
@kami-ayati I don't know what you're talking about