Skip to content

Commit 0507f70

Browse files
committed
Update
[ghstack-poisoned]
1 parent a99b088 commit 0507f70

File tree

3 files changed

+40
-14
lines changed

3 files changed

+40
-14
lines changed

.github/unittest/linux_libs/scripts_isaaclab/isaac.sh

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export TF_CPP_MIN_LOG_LEVEL=0
2020
export BATCHED_PIPE_TIMEOUT=60
2121
export TD_GET_DEFAULTS_TO_NONE=1
2222
export OMNI_KIT_ACCEPT_EULA=yes
23+
export PIP_DISABLE_PIP_VERSION_CHECK=1
24+
export PYTHONNOUSERSITE=1
2325

2426
nvidia-smi
2527

@@ -52,14 +54,31 @@ export LD_LIBRARY_PATH=${lib_dir}:${LD_LIBRARY_PATH:-}
5254
# Ensure libexpat is at the correct version BEFORE installing other packages
5355
conda install -c conda-forge expat -y
5456

57+
# Force the loader to pick conda's libexpat over the system one
58+
if [ -f "${lib_dir}/libexpat.so.1" ]; then
59+
export LD_PRELOAD="${lib_dir}/libexpat.so.1:${LD_PRELOAD:-}"
60+
elif [ -f "${lib_dir}/libexpat.so" ]; then
61+
export LD_PRELOAD="${lib_dir}/libexpat.so:${LD_PRELOAD:-}"
62+
fi
63+
64+
# Quick diagnostic to confirm which expat is resolved by pyexpat
65+
PYEXPAT_SO=$(python - <<'PY'
66+
import importlib.util
67+
spec = importlib.util.find_spec('pyexpat')
68+
print(spec.origin)
69+
PY
70+
)
71+
echo "* pyexpat module: ${PYEXPAT_SO}"
72+
ldd "${PYEXPAT_SO}" | grep -i expat || true
73+
5574
# Reinstall Python to ensure it links against the correct expat
5675
conda install --force-reinstall python=3.10 -y
5776

5877
# Pin pytorch to 2.5.1 for IsaacLab
5978
conda install pytorch==2.5.1 torchvision==0.20.1 pytorch-cuda=12.4 -c pytorch -c nvidia -y
6079

61-
python -m pip install --upgrade pip
62-
python -m pip install 'isaacsim[all,extscache]==4.5.0' --extra-index-url https://pypi.nvidia.com
80+
python -m pip install --upgrade pip --disable-pip-version-check
81+
python -m pip install 'isaacsim[all,extscache]==4.5.0' --extra-index-url https://pypi.nvidia.com --disable-pip-version-check
6382
conda install conda-forge::"cmake>3.22" -y
6483

6584
git clone https://github.com/isaac-sim/IsaacLab.git
@@ -70,21 +89,21 @@ cd ../
7089
# install tensordict
7190
if [[ "$RELEASE" == 0 ]]; then
7291
conda install "anaconda::cmake>=3.22" -y
73-
python -m pip install "pybind11[global]"
74-
python -m pip install git+https://github.com/pytorch/tensordict.git
92+
python -m pip install "pybind11[global]" --disable-pip-version-check
93+
python -m pip install git+https://github.com/pytorch/tensordict.git --disable-pip-version-check
7594
else
76-
python -m pip install tensordict
95+
python -m pip install tensordict --disable-pip-version-check
7796
fi
7897

7998
# smoke test
8099
python -c "import tensordict"
81100

82101
printf "* Installing torchrl\n"
83-
python -m pip install -e . --no-build-isolation
102+
python -m pip install -e . --no-build-isolation --disable-pip-version-check
84103
python -c "import torchrl"
85104

86105
# Install pytest
87-
python -m pip install pytest pytest-cov pytest-mock pytest-instafail pytest-rerunfailures pytest-error-for-skips pytest-asyncio
106+
python -m pip install pytest pytest-cov pytest-mock pytest-instafail pytest-rerunfailures pytest-error-for-skips pytest-asyncio --disable-pip-version-check
88107

89108
# Run tests
90109
python -m pytest test/test_libs.py -k isaac -s

test/test_libs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3464,7 +3464,9 @@ def test_dataset_build(self, task, split_trajs, from_env):
34643464
task, split_trajs=split_trajs, from_env=from_env, batch_size=2
34653465
)
34663466
sample = data.sample()
3467-
env = GymWrapper(gym.make(task))
3467+
# D4RL environments are registered with gym, not gymnasium
3468+
with set_gym_backend("gym"):
3469+
env = GymWrapper(gym.make(task))
34683470
rollout = env.rollout(2)
34693471
for key in rollout.keys(True, True):
34703472
if "truncated" in key:

torchrl/data/datasets/d4rl.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,16 +267,19 @@ def _get_dataset_direct_download(self, name, env_kwargs):
267267
return dataset
268268

269269
def _get_dataset_direct(self, name, env_kwargs):
270-
from torchrl.envs.libs.gym import GymWrapper
270+
from torchrl.envs.libs.gym import GymWrapper, set_gym_backend
271271

272272
type(self)._import_d4rl()
273273

274274
if not self._has_d4rl:
275275
raise ImportError("Could not import d4rl") from self.D4RL_ERR
276276
import d4rl
277-
import gym
278277

279-
env = GymWrapper(gym.make(name))
278+
# D4RL environments are registered with gym, not gymnasium
279+
# so we need to ensure we're using the gym backend
280+
with set_gym_backend("gym"):
281+
import gym
282+
env = GymWrapper(gym.make(name))
280283
with tempfile.TemporaryDirectory() as tmpdir:
281284
os.environ["D4RL_DATASET_DIR"] = tmpdir
282285
dataset = d4rl.qlearning_dataset(env._env, **env_kwargs)
@@ -347,12 +350,14 @@ def _get_dataset_from_env(self, name, env_kwargs):
347350
if env_kwargs:
348351
raise RuntimeError("env_kwargs cannot be passed with using from_env=True")
349352
import d4rl # noqa: F401
350-
import gym
351353

352354
# we do a local import to avoid circular import issues
353-
from torchrl.envs.libs.gym import GymWrapper
355+
from torchrl.envs.libs.gym import GymWrapper, set_gym_backend
354356

355-
with tempfile.TemporaryDirectory() as tmpdir:
357+
# D4RL environments are registered with gym, not gymnasium
358+
# so we need to ensure we're using the gym backend
359+
with set_gym_backend("gym"), tempfile.TemporaryDirectory() as tmpdir:
360+
import gym
356361
os.environ["D4RL_DATASET_DIR"] = tmpdir
357362
env = GymWrapper(gym.make(name))
358363
dataset = make_tensordict(

0 commit comments

Comments
 (0)