Skip to content

Commit ae50733

Browse files
authored
[CI,BugFix] Fix Habitat CI by upgrading to Python 3.10 and building habitat-sim from source (#3346)
1 parent a4c0e89 commit ae50733

File tree

4 files changed

+66
-34
lines changed

4 files changed

+66
-34
lines changed

.github/unittest/linux_libs/scripts_habitat/run_all.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ set -v
55

66

77
apt-get update && apt-get upgrade -y
8-
apt-get install -y vim git wget cmake
8+
apt-get install -y vim git wget cmake ninja-build
99

10-
apt-get install -y libglfw3 libgl1-mesa-glx libosmesa6 libglew-dev
10+
# OpenGL/EGL dependencies for headless rendering
11+
apt-get install -y libglfw3 libglfw3-dev libgl1-mesa-glx libosmesa6 libosmesa6-dev libglew-dev
1112
apt-get install -y libglvnd0 libgl1 libglx0 libegl1 libgles2
13+
apt-get install -y libegl1-mesa-dev libgles2-mesa-dev
1214

15+
# Build tools and libraries for habitat-sim
1316
apt-get install -y g++ gcc
17+
apt-get install -y libjpeg-dev libpng-dev
18+
apt-get install -y pkg-config
19+
1420
#apt-get upgrade -y libstdc++6
1521
#apt-get install -y libgcc
1622
apt-get dist-upgrade -y

.github/unittest/linux_libs/scripts_habitat/run_test.sh

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,33 @@ set -v
66
eval "$(./conda/bin/conda shell.bash hook)"
77
conda activate ./env
88

9-
# we can install this now but not before installing tensordict and torchrl, g++ version will break the compilation
10-
# https://stackoverflow.com/questions/72540359/glibcxx-3-4-30-not-found-for-librosa-in-conda-virtual-environment-after-tryin
11-
#conda install -y -c conda-forge gcc=12.1.0
12-
conda install -y -c conda-forge libstdcxx-ng=12
13-
conda env config vars set \
14-
MAX_IDLE_COUNT=1000 \
15-
LD_PRELOAD=$LD_PRELOAD:$STDC_LOC TOKENIZERS_PARALLELISM=true
16-
17-
## find libstdc
18-
STDC_LOC=$(find conda/ -name "libstdc++.so.6" | head -1)
9+
# Note: We no longer install libstdcxx-ng=12 here since we're building habitat-sim from source
10+
# and the pip-installed PyTorch has its own compatible libstdc++
1911

2012
export PYTORCH_TEST_WITH_SLOW='1'
2113
export LAZY_LEGACY_OP=False
22-
python -m torch.utils.collect_env
14+
2315
# Avoid error: "fatal: unsafe repository"
2416
git config --global --add safe.directory '*'
2517

2618
root_dir="$(git rev-parse --show-toplevel)"
2719
env_dir="${root_dir}/env"
2820
lib_dir="${env_dir}/lib"
2921

30-
# smoke test
31-
python -c "import habitat;import habitat.gym"
32-
33-
# solves ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found
22+
# Set library path to include environment lib
3423
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$lib_dir
3524
export MKL_THREADING_LAYER=GNU
36-
# more logging
3725

38-
#wget https://github.com/openai/mujoco-py/blob/master/vendor/10_nvidia.json
39-
#mv 10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json
26+
# Verify torch works
27+
python -m torch.utils.collect_env
4028

29+
# Set habitat environment variables
4130
conda env config vars set \
4231
MAX_IDLE_COUNT=1000 \
4332
MAGNUM_LOG=quiet HABITAT_SIM_LOG=quiet TOKENIZERS_PARALLELISM=true
44-
4533
conda deactivate && conda activate ./env
4634

47-
48-
# this workflow only tests the libs
35+
# smoke test
4936
python -c "import habitat;import habitat.gym"
5037
python -c """from torchrl.envs.libs.habitat import HabitatEnv
5138
env = HabitatEnv('HabitatRenderPick-v0')

.github/unittest/linux_libs/scripts_habitat/setup_env.sh

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,26 @@ conda deactivate && conda activate "${env_dir}"
4949
pip3 install "cython<3"
5050
conda install -c anaconda cython="<3.0.0" -y
5151

52-
53-
# 3. Install git LFS
54-
mkdir git_lfs
55-
wget https://github.com/git-lfs/git-lfs/releases/download/v2.9.0/git-lfs-linux-amd64-v2.9.0.tar.gz --directory-prefix git_lfs
56-
cd git_lfs
57-
tar -xf git-lfs-linux-amd64-v2.9.0.tar.gz
58-
chmod 755 install.sh
59-
./install.sh
60-
cd ..
52+
# 3. Install git LFS (newer version that supports git lfs prune -f)
53+
mkdir -p git_lfs_tmp
54+
cd git_lfs_tmp
55+
wget https://github.com/git-lfs/git-lfs/releases/download/v3.4.0/git-lfs-linux-amd64-v3.4.0.tar.gz
56+
tar -xf git-lfs-linux-amd64-v3.4.0.tar.gz
57+
# The binary is in git-lfs-3.4.0/git-lfs
58+
chmod 755 git-lfs-3.4.0/git-lfs
59+
# Install to /usr/local/bin so it's available system-wide
60+
cp git-lfs-3.4.0/git-lfs /usr/local/bin/
61+
cd "${root_dir}"
6162
git lfs install
6263

64+
# Configure git-lfs for better performance (higher timeouts, more concurrent transfers)
65+
git config --global lfs.activitytimeout 600
66+
git config --global lfs.dialtimeout 60
67+
git config --global lfs.tlstimeout 60
68+
git config --global lfs.concurrenttransfers 8
69+
git config --global http.version HTTP/1.1
70+
rm -rf git_lfs_tmp
71+
6372
# 4. Install Conda dependencies
6473
printf "* Installing dependencies (except PyTorch)\n"
6574
echo " - python=${PYTHON_VERSION}" >> "${this_dir}/environment.yml"
@@ -69,7 +78,37 @@ pip install pip --upgrade
6978

7079
conda env update --file "${this_dir}/environment.yml" --prune
7180

72-
conda install habitat-sim withbullet headless -c conda-forge -c aihabitat -y
81+
# 5. Install habitat-sim from source (conda packages don't support Python 3.10+)
82+
# Install build dependencies
83+
pip3 install ninja numpy
84+
85+
# Clone and build habitat-sim from source
86+
cd "${root_dir}"
87+
git clone --branch stable https://github.com/facebookresearch/habitat-sim.git --recursive
88+
cd habitat-sim
89+
90+
# Build with headless (EGL) and bullet physics support
91+
# Ensure system cmake is used (pip cmake 4.x is incompatible with habitat-sim's CMake files)
92+
# Put /usr/bin at the front of PATH to prefer system cmake over any pip-installed cmake
93+
export PATH="/usr/bin:$PATH"
94+
# Also set CMAKE_EXECUTABLE to explicitly use system cmake
95+
export CMAKE_EXECUTABLE=/usr/bin/cmake
96+
pip3 install . --no-build-isolation
97+
98+
cd "${root_dir}"
99+
100+
# 6. Download required Habitat test datasets
101+
# Use datasets_download with git-lfs configured for better performance
102+
echo "$(date): Starting dataset downloads..."
103+
104+
# Download all rearrange task assets (includes replica_cad, ycb, robots, and episode data)
105+
python -m habitat_sim.utils.datasets_download --uids rearrange_task_assets --data-path data/ --no-prune
106+
107+
echo "$(date): Dataset downloads complete!"
108+
echo "Total data size:"
109+
du -sh data/
110+
111+
# Install habitat-lab
73112
git clone https://github.com/facebookresearch/habitat-lab.git
74113
cd habitat-lab
75114
pip3 install -e habitat-lab

.github/workflows/test-linux-habitat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
tests:
2424
strategy:
2525
matrix:
26-
python_version: ["3.9"]
26+
python_version: ["3.10"]
2727
cuda_arch_version: ["12.8"]
2828
fail-fast: false
2929
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main

0 commit comments

Comments
 (0)