Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The assets data need to be packaged #231

Open
Skylark0924 opened this issue Nov 3, 2022 · 3 comments
Open

The assets data need to be packaged #231

Skylark0924 opened this issue Nov 3, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@Skylark0924
Copy link

Skylark0924 commented Nov 3, 2022

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,
@YangletLiu YangletLiu added the bug Something isn't working label Nov 3, 2022
@Skylark0924
Copy link
Author

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")

@kami-ayati
Copy link

your plugins is not in this path.check it it may be for os.

@Skylark0924
Copy link
Author

@kami-ayati I don't know what you're talking about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants