AI4Finance-Foundation / AI4Finance-Foundation/ElegantRL

The assets data need to be packaged

Abierto
#231 3 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Python
Estrellas
4.4k
Forks
978
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## Bugs

When I tested the Isaac tutorial with elegantRL (use this [code](https://github.com/AI4Finance-Foundation/ElegantRL/blob/IsaacGym-Single-Process/demo_IsaacGym.py) the author mentioned in [this issue](https://github.com/AI4Finance-Foundation/ElegantRL/issues/169)). 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
```python
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
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
```python
[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.

```python
# 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.
```python
# 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](https://github.com/Skylark0924/Rofunc/blob/main/MANIFEST.in). And then modify the `setup.py` as

```python
include_package_data=True,
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.