Skip to content

Commit d628a50

Browse files
author
Vincent Moens
committed
[CI] Local import of PIL
ghstack-source-id: 6eb4ace Pull Request resolved: #2720
1 parent f2cf5e0 commit d628a50

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

test/test_libs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,8 @@ def test_torchrl_to_gym(self, backend, numpy):
636636

637637
@implement_for("gym", None, "0.26")
638638
def test_gym_dict_action_space(self):
639-
pytest.skip("tested for gym > 0.26 - no backward issue")
639+
torchrl_logger.info("tested for gym > 0.26 - no backward issue")
640+
return
640641

641642
@implement_for("gym", "0.26", None)
642643
def test_gym_dict_action_space(self): # noqa: F811

torchrl/envs/custom/chess.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from typing import Dict
1111

1212
import torch
13-
from PIL import Image
1413
from tensordict import TensorDict, TensorDictBase
1514
from torchrl.data import Binary, Bounded, Categorical, Composite, NonTensor, Unbounded
1615

@@ -430,6 +429,8 @@ def _torchvision(cls):
430429
@classmethod
431430
def _get_tensor_image(cls, board):
432431
try:
432+
from PIL import Image
433+
433434
svg = board._repr_svg_()
434435
# Convert SVG to PNG using cairosvg
435436
png_data = io.BytesIO()
@@ -440,7 +441,7 @@ def _get_tensor_image(cls, board):
440441
img = cls._torchvision.transforms.functional.pil_to_tensor(img)
441442
except ImportError:
442443
raise ImportError(
443-
"Chess rendering requires cairosvg and torchvision to be installed."
444+
"Chess rendering requires cairosvg, PIL and torchvision to be installed."
444445
)
445446
return img
446447

0 commit comments

Comments
 (0)