mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-15 00:29:52 +00:00
fix(docker): pre-create libero config.yaml to avoid interactive input() prompt
The upstream libero __init__.py calls input() when ~/.libero/config.yaml is missing, which crashes in non-interactive Docker containers with EOFError. Pre-create the config with default paths at build time using importlib.util.find_spec to locate the module without triggering the problematic import. Made-with: Cursor
This commit is contained in:
@@ -116,7 +116,15 @@ RUN case "${BENCHMARK}" in \
|
||||
&& PATH=/usr/bin:/bin:/lerobot/.venv/bin:$PATH /lerobot/.venv/bin/python -m pip install --no-cache-dir --no-deps /tmp/LIBERO-plus \
|
||||
&& /lerobot/.venv/bin/python -c "import pathlib, site; pathlib.Path(site.getsitepackages()[0], 'libero_plus_repo.pth').write_text('/tmp/LIBERO-plus\n')" \
|
||||
&& /lerobot/.venv/bin/python -m pip install --no-cache-dir . \
|
||||
&& /lerobot/.venv/bin/python -c "import libero, robosuite, bddl" ;; \
|
||||
&& /lerobot/.venv/bin/python -c "\
|
||||
import os, yaml, importlib.util; \
|
||||
root = os.path.dirname(importlib.util.find_spec('libero.libero').origin); \
|
||||
d = dict(benchmark_root=root, bddl_files=os.path.join(root,'bddl_files'), \
|
||||
init_states=os.path.join(root,'init_files'), datasets=os.path.join(root,'..','datasets'), \
|
||||
assets=os.path.join(root,'assets')); \
|
||||
cfg_dir = os.path.expanduser('~/.libero'); os.makedirs(cfg_dir, exist_ok=True); \
|
||||
yaml.dump(d, open(os.path.join(cfg_dir,'config.yaml'),'w')); print('libero config created')" \
|
||||
&& /lerobot/.venv/bin/python -c "from libero.libero import benchmark, get_libero_path; print('libero OK')" ;; \
|
||||
*) \
|
||||
uv pip install --no-cache ".[${BENCHMARK}]" ;; \
|
||||
esac
|
||||
|
||||
@@ -34,6 +34,14 @@ RUN uv pip install --no-cache \
|
||||
RUN git clone --depth 1 https://github.com/sylvestf/LIBERO-plus.git /tmp/LIBERO-plus \
|
||||
&& uv pip install --no-cache --no-deps /tmp/LIBERO-plus \
|
||||
&& python -c "import pathlib, site; pathlib.Path(site.getsitepackages()[0], 'libero_plus_repo.pth').write_text('/tmp/LIBERO-plus\n')" \
|
||||
&& python -c "import libero, robosuite, bddl"
|
||||
&& python -c "\
|
||||
import os, yaml, importlib.util; \
|
||||
root = os.path.dirname(importlib.util.find_spec('libero.libero').origin); \
|
||||
d = dict(benchmark_root=root, bddl_files=os.path.join(root,'bddl_files'), \
|
||||
init_states=os.path.join(root,'init_files'), datasets=os.path.join(root,'..','datasets'), \
|
||||
assets=os.path.join(root,'assets')); \
|
||||
cfg_dir = os.path.expanduser('~/.libero'); os.makedirs(cfg_dir, exist_ok=True); \
|
||||
yaml.dump(d, open(os.path.join(cfg_dir,'config.yaml'),'w')); print('libero config created')" \
|
||||
&& python -c "from libero.libero import benchmark, get_libero_path; print('libero OK')"
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
Reference in New Issue
Block a user