diff --git a/.github/unittest/linux/scripts/run_all.sh b/.github/unittest/linux/scripts/run_all.sh index e125bf927ee..174e1b84deb 100755 --- a/.github/unittest/linux/scripts/run_all.sh +++ b/.github/unittest/linux/scripts/run_all.sh @@ -25,7 +25,7 @@ if [[ $OSTYPE != 'darwin'* ]]; then apt-get install -y libfreetype6-dev pkg-config apt-get install -y libglfw3 libosmesa6 libglew-dev - apt-get install -y libglvnd0 libgl1 libglx0 libglx-mesa0 libegl1 libgles2 xvfb + apt-get install -y libglvnd0 libgl1 libglx0 libglx-mesa0 libegl1 libgles2 xvfb ffmpeg if [ "${CU_VERSION:-}" == cpu ] ; then apt-get upgrade -y libstdc++6 @@ -205,15 +205,15 @@ git submodule sync && git submodule update --init --recursive printf "Installing PyTorch with %s\n" "${CU_VERSION}" if [[ "$TORCH_VERSION" == "nightly" ]]; then if [ "${CU_VERSION:-}" == cpu ] ; then - uv_pip_install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu + uv_pip_install --upgrade --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu else - uv_pip_install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION + uv_pip_install --upgrade --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION fi elif [[ "$TORCH_VERSION" == "stable" ]]; then if [ "${CU_VERSION:-}" == cpu ] ; then - uv_pip_install torch torchvision --index-url https://download.pytorch.org/whl/cpu + uv_pip_install --upgrade torch torchvision --index-url https://download.pytorch.org/whl/cpu else - uv_pip_install torch torchvision --index-url https://download.pytorch.org/whl/$CU_VERSION + uv_pip_install --upgrade torch torchvision --index-url https://download.pytorch.org/whl/$CU_VERSION fi else printf "Failed to install pytorch" diff --git a/.github/unittest/linux/scripts/run_setup_test.sh b/.github/unittest/linux/scripts/run_setup_test.sh index e95ed547a5a..a243b3a8d8c 100644 --- a/.github/unittest/linux/scripts/run_setup_test.sh +++ b/.github/unittest/linux/scripts/run_setup_test.sh @@ -66,9 +66,9 @@ else fi if [[ "$TORCH_VERSION" == "nightly" ]]; then - uv_pip_install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu + uv_pip_install --upgrade --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu else - uv_pip_install torch torchvision --index-url https://download.pytorch.org/whl/cpu + uv_pip_install --upgrade torch torchvision --index-url https://download.pytorch.org/whl/cpu fi # tensordict is a hard dependency of torchrl; install it explicitly since we test diff --git a/.github/unittest/linux_libs/scripts_minari/install.sh b/.github/unittest/linux_libs/scripts_minari/install.sh index d9bbee6276f..8febf63dcdc 100755 --- a/.github/unittest/linux_libs/scripts_minari/install.sh +++ b/.github/unittest/linux_libs/scripts_minari/install.sh @@ -33,9 +33,9 @@ if [[ "$TORCH_VERSION" == "nightly" ]]; then fi elif [[ "$TORCH_VERSION" == "stable" ]]; then if [ "${CU_VERSION:-}" == cpu ] ; then - uv pip install torch --index-url https://download.pytorch.org/whl/cpu + uv pip install torch --index-url https://download.pytorch.org/whl/cpu -U else - uv pip install torch --index-url https://download.pytorch.org/whl/cu128 + uv pip install torch --index-url https://download.pytorch.org/whl/cu128 -U fi else printf "Failed to install pytorch" diff --git a/.github/unittest/linux_libs/scripts_vd4rl/install.sh b/.github/unittest/linux_libs/scripts_vd4rl/install.sh index 293cf07b8bf..eb1e1c60ba1 100755 --- a/.github/unittest/linux_libs/scripts_vd4rl/install.sh +++ b/.github/unittest/linux_libs/scripts_vd4rl/install.sh @@ -37,7 +37,7 @@ elif [[ "$TORCH_VERSION" == "stable" ]]; then if [ "${CU_VERSION:-}" == cpu ] ; then pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu -U else - pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu128 + pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu128 -U fi else printf "Failed to install pytorch" diff --git a/.github/unittest/linux_libs/scripts_vmas/install.sh b/.github/unittest/linux_libs/scripts_vmas/install.sh index 8a71f05120c..1b717a16e41 100755 --- a/.github/unittest/linux_libs/scripts_vmas/install.sh +++ b/.github/unittest/linux_libs/scripts_vmas/install.sh @@ -34,9 +34,9 @@ if [[ "$TORCH_VERSION" == "nightly" ]]; then fi elif [[ "$TORCH_VERSION" == "stable" ]]; then if [ "${CU_VERSION:-}" == cpu ] ; then - pip3 install torch --index-url https://download.pytorch.org/whl/cpu + pip3 install torch --index-url https://download.pytorch.org/whl/cpu -U else - pip3 install torch --index-url https://download.pytorch.org/whl/cu128 + pip3 install torch --index-url https://download.pytorch.org/whl/cu128 -U fi else printf "Failed to install pytorch" diff --git a/.github/unittest/linux_optdeps/scripts/run_all.sh b/.github/unittest/linux_optdeps/scripts/run_all.sh index 108f52a8527..eaeb4330a9c 100755 --- a/.github/unittest/linux_optdeps/scripts/run_all.sh +++ b/.github/unittest/linux_optdeps/scripts/run_all.sh @@ -23,7 +23,7 @@ if [[ $OSTYPE != 'darwin'* ]]; then apt-get install -y vim git wget cmake apt-get install -y libglfw3 libosmesa6 libglew-dev - apt-get install -y libglvnd0 libgl1 libglx0 libglx-mesa0 libegl1 libgles2 + apt-get install -y libglvnd0 libgl1 libglx0 libglx-mesa0 libegl1 libgles2 xvfb ffmpeg if [ "${CU_VERSION:-}" == cpu ] ; then # solves version `GLIBCXX_3.4.29' not found for tensorboard diff --git a/.github/unittest/linux_sota/scripts/run_all.sh b/.github/unittest/linux_sota/scripts/run_all.sh index c899dc5f693..20f7bcc4d27 100755 --- a/.github/unittest/linux_sota/scripts/run_all.sh +++ b/.github/unittest/linux_sota/scripts/run_all.sh @@ -115,15 +115,15 @@ git submodule sync && git submodule update --init --recursive printf "Installing PyTorch with %s\n" "${CU_VERSION}" if [[ "$TORCH_VERSION" == "nightly" ]]; then if [ "${CU_VERSION:-}" == cpu ] ; then - uv pip install --pre torch torchvision "numpy==1.26.4" --index-url https://download.pytorch.org/whl/nightly/cpu + uv pip install --upgrade --pre torch torchvision "numpy==1.26.4" --index-url https://download.pytorch.org/whl/nightly/cpu else - uv pip install --pre torch torchvision "numpy==1.26.4" --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION + uv pip install --upgrade --pre torch torchvision "numpy==1.26.4" --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION fi elif [[ "$TORCH_VERSION" == "stable" ]]; then if [ "${CU_VERSION:-}" == cpu ] ; then - uv pip install torch torchvision "numpy==1.26.4" --index-url https://download.pytorch.org/whl/cpu + uv pip install --upgrade torch torchvision "numpy==1.26.4" --index-url https://download.pytorch.org/whl/cpu else - uv pip install torch torchvision "numpy==1.26.4" --index-url https://download.pytorch.org/whl/$CU_VERSION + uv pip install --upgrade torch torchvision "numpy==1.26.4" --index-url https://download.pytorch.org/whl/$CU_VERSION fi else printf "Failed to install pytorch" diff --git a/.github/unittest/windows_optdepts/scripts/unittest.sh b/.github/unittest/windows_optdepts/scripts/unittest.sh index 7241d7a53d2..4d4a6f5726f 100755 --- a/.github/unittest/windows_optdepts/scripts/unittest.sh +++ b/.github/unittest/windows_optdepts/scripts/unittest.sh @@ -71,15 +71,15 @@ python -m pip install "numpy<2.0" printf "Installing PyTorch with %s\n" "${cudatoolkit}" if [[ "$TORCH_VERSION" == "nightly" ]]; then if $torch_cuda ; then - python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu118 + python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu118 -U else python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U fi elif [[ "$TORCH_VERSION" == "stable" ]]; then if $torch_cuda ; then - python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu118 + python -m pip install torch --index-url https://download.pytorch.org/whl/cu118 -U else - python -m pip install torch --index-url https://download.pytorch.org/whl/cpu + python -m pip install torch --index-url https://download.pytorch.org/whl/cpu -U fi else printf "Failed to install pytorch" diff --git a/torchrl/envs/batched_envs.py b/torchrl/envs/batched_envs.py index 8b1b3cd7cd0..bd2a698ac4e 100644 --- a/torchrl/envs/batched_envs.py +++ b/torchrl/envs/batched_envs.py @@ -1418,12 +1418,11 @@ class ParallelEnv(BatchedEnvBase, metaclass=_PEnvMeta): def _start_workers(self) -> None: import torchrl + from torchrl.envs.env_creator import EnvCreator self._timeout = 10.0 self.BATCHED_PIPE_TIMEOUT = torchrl._utils.BATCHED_PIPE_TIMEOUT - from torchrl.envs.env_creator import EnvCreator - num_threads = max( 1, torch.get_num_threads() - self.num_workers ) # 1 more thread for this proc @@ -1478,8 +1477,6 @@ def look_for_cuda(tensor, has_cuda=has_cuda): env_fun = self.create_env_fn[idx] if not isinstance(env_fun, (EnvCreator, CloudpickleWrapper)): env_fun = CloudpickleWrapper(env_fun) - import torchrl - kwargs[idx].update( { "parent_pipe": parent_pipe,