@@ -19,8 +19,8 @@ dpkg-reconfigure -f noninteractive tzdata || true
1919apt-get upgrade -y
2020apt-get install -y vim git wget cmake
2121
22- apt-get install -y libglfw3 libgl1-mesa-glx libosmesa6 libglew-dev libosmesa6-dev
23- apt-get install -y libglvnd0 libgl1 libglx0 libegl1 libgles2
22+ apt-get install -y libglfw3 libosmesa6 libglew-dev libosmesa6-dev
23+ apt-get install -y libglvnd0 libgl1 libglx0 libglx-mesa0 libegl1 libgles2
2424apt-get install -y g++ gcc patchelf
2525
2626this_dir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
@@ -36,7 +36,6 @@ git config --global --add safe.directory '*'
3636root_dir=" $( git rev-parse --show-toplevel) "
3737conda_dir=" ${root_dir} /conda"
3838env_dir=" ${root_dir} /env"
39- lib_dir=" ${env_dir} /lib"
4039
4140cd " ${root_dir} "
4241
@@ -57,29 +56,15 @@ eval "$(${conda_dir}/bin/conda shell.bash hook)"
5756printf " python: ${PYTHON_VERSION} \n"
5857if [ ! -d " ${env_dir} " ]; then
5958 printf " * Creating a test environment\n"
60- conda create --prefix " ${env_dir} " -y python=" $PYTHON_VERSION "
59+ # Force CPython from the main conda channels (avoid GraalPy).
60+ conda create --override-channels -c defaults -c pytorch --prefix " ${env_dir} " -y python=" $PYTHON_VERSION "
6161fi
6262conda activate " ${env_dir} "
6363
64- # Verify we have CPython, not PyPy
65- python_impl=$( python -c " import platform; print(platform.python_implementation())" )
66- if [ " $python_impl " != " CPython" ]; then
67- echo " ERROR: Expected CPython but got $python_impl "
68- echo " Python executable: $( which python) "
69- echo " Python version: $( python --version) "
70- exit 1
71- fi
72- printf " * Verified Python implementation: %s\n" " $python_impl "
64+ # Verify we're running CPython (wheels won't work on GraalPy)
65+ python -c " import sys; assert sys.implementation.name == 'cpython', f'Expected CPython, got {sys.implementation.name}'"
7366
7467# 3. Install mujoco
75- printf " * Installing mujoco and related\n"
76- mkdir -p $root_dir /.mujoco
77- cd $root_dir /.mujoco/
78- # wget https://github.com/deepmind/mujoco/releases/download/2.1.1/mujoco-2.1.1-linux-x86_64.tar.gz
79- # tar -xf mujoco-2.1.1-linux-x86_64.tar.gz
80- wget https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz
81- tar -xf mujoco210-linux-x86_64.tar.gz
82- cd " ${root_dir} "
8368
8469# 4. Install Conda dependencies
8570printf " * Installing dependencies (except PyTorch)\n"
@@ -89,9 +74,6 @@ if ! grep -q "python=${PYTHON_VERSION}" "${this_dir}/environment.yml"; then
8974fi
9075cat " ${this_dir} /environment.yml"
9176
92- export MUJOCO_PY_MUJOCO_PATH=$root_dir /.mujoco/mujoco210
93- # export MJLIB_PATH=$root_dir/.mujoco/mujoco-2.1.1/lib/libmujoco.so.2.1.1
94- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH :$root_dir /.mujoco/mujoco210/bin
9577export SDL_VIDEODRIVER=dummy
9678export MUJOCO_GL=egl
9779export PYOPENGL_PLATFORM=egl
@@ -100,26 +82,21 @@ export COMPOSITE_LP_AGGREGATE=0
10082
10183conda env config vars set \
10284 MAX_IDLE_COUNT=1000 \
103- MUJOCO_PY_MUJOCO_PATH=$root_dir /.mujoco/mujoco210 \
10485 DISPLAY=:99 \
105- LD_LIBRARY_PATH=$LD_LIBRARY_PATH :$root_dir /.mujoco/mujoco210/bin \
10686 SDL_VIDEODRIVER=dummy \
10787 MUJOCO_GL=egl \
10888 PYOPENGL_PLATFORM=egl \
10989 BATCHED_PIPE_TIMEOUT=60 \
11090 TOKENIZERS_PARALLELISM=true
11191
112- pip install pip --upgrade
92+ # Use python -m pip to ensure we use conda's Python, not system GraalPy
93+ python -m pip install pip --upgrade
11394
11495conda env update --file " ${this_dir} /environment.yml" --prune
11596
11697conda deactivate
11798conda activate " ${env_dir} "
11899
119- # install d4rl
120- pip install free-mujoco-py
121- pip install git+https://github.com/Farama-Foundation/d4rl@master#egg=d4rl
122-
123100# TODO: move this down -- will break torchrl installation
124101conda install -y -c conda-forge libstdcxx-ng=12
125102# # find libstdc - search in the env's lib directory first, then fall back to conda packages
144121conda deactivate
145122conda activate " ${env_dir} "
146123
147- # compile mujoco-py (bc it's done at runtime for whatever reason someone thought it was a good idea)
148- python -c " " " import gym;import d4rl" " "
149-
150- # install ale-py: manylinux names are broken for CentOS so we need to manually download and
151- # rename them
152-
153124# ============================================================================================ #
154125# ================================ PyTorch & TorchRL ========================================= #
155126
@@ -160,26 +131,24 @@ elif [[ ${#CU_VERSION} -eq 5 ]]; then
160131 CUDA_VERSION=" ${CU_VERSION: 2: 2} .${CU_VERSION: 4: 1} "
161132fi
162133echo " Using CUDA $CUDA_VERSION as determined by CU_VERSION ($CU_VERSION )"
163- version=" $( python -c " print('.'.join(\" ${CUDA_VERSION} \" .split('.')[:2]))" ) "
164-
165134# submodules
166135git submodule sync && git submodule update --init --recursive
167136
168- pip3 install ale-py -U
169- pip3 install " gym [atari,accept-rom-license] " " gymnasium >=1.1.0" -U
137+ # Gymnasium Atari support pulls ale-py (+ ROMs) as needed.
138+ python -m pip install -U " gymnasium [atari,accept-rom-license,mujoco] >=1.1.0"
170139
171140printf " Installing PyTorch with %s\n" " ${CU_VERSION} "
172141if [[ " $TORCH_VERSION " == " nightly" ]]; then
173142 if [ " ${CU_VERSION:- } " == cpu ] ; then
174- pip3 install --pre torch torchvision numpy==1.26.4 --index-url https://download.pytorch.org/whl/nightly/cpu -U
143+ python -m pip install --pre torch torchvision numpy==1.26.4 --index-url https://download.pytorch.org/whl/nightly/cpu -U
175144 else
176- pip3 install --pre torch torchvision numpy==1.26.4 --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION
145+ python -m pip install --pre torch torchvision numpy==1.26.4 --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION
177146 fi
178147elif [[ " $TORCH_VERSION " == " stable" ]]; then
179148 if [ " ${CU_VERSION:- } " == cpu ] ; then
180- pip3 install torch torchvision numpy==1.26.4 --index-url https://download.pytorch.org/whl/cpu
149+ python -m pip install torch torchvision numpy==1.26.4 --index-url https://download.pytorch.org/whl/cpu
181150 else
182- pip3 install torch torchvision numpy==1.26.4 --index-url https://download.pytorch.org/whl/$CU_VERSION
151+ python -m pip install torch torchvision numpy==1.26.4 --index-url https://download.pytorch.org/whl/$CU_VERSION
183152 fi
184153else
185154 printf " Failed to install pytorch"
@@ -194,9 +163,9 @@ python -c "import functorch"
194163
195164# install tensordict
196165if [[ " $RELEASE " == 0 ]]; then
197- pip3 install git+https://github.com/pytorch/tensordict.git
166+ python -m pip install git+https://github.com/pytorch/tensordict.git
198167else
199- pip3 install tensordict
168+ python -m pip install tensordict
200169fi
201170
202171printf " * Installing torchrl\n"
0 commit comments