huawei-noah/SMARTS

Error when running make sanity-test: TabError in e2_single_agent example

Open

#2,174 opened on Apr 20, 2025

 (0 comments) (0 reactions) (0 assignees)Python (220 forks)auto 404
help wanted

Repository metrics

Stars
 (1,129 stars)
PR merge metrics
 (PR metrics pending)

Description

High Level Description

Hi there! I encountered an issue when running make sanity-test, and below is the full error output I see in the terminal: (.venv) ubuntu@ubuntu-Legion-Y9000P-IAH7H:~/SMARTS$ make sanity-test scl scenario build --clean scenarios/sumo/loop Building: scenarios/sumo/loop scl scenario build --clean scenarios/sumo/zoo_intersection Building: scenarios/sumo/zoo_intersection PYTHONPATH=/home/ubuntu/SMARTS PYTHONHASHSEED=42 pytest -v
--doctest-modules
--forked
--dist=loadscope
--junitxml="sanity_test_result.xml"
-n expr \( \nproc` / 2 & `nproc` > 3 ) | 2`
./smarts/core/tests/test_python_version.py::test_python_version
./smarts/core/tests/test_sumo_version.py::test_sumo_version
./smarts/core/tests/test_dynamics_backend.py::test_set_pose
./smarts/core/tests/test_sensors.py::test_waypoints_sensor
./smarts/core/tests/test_smarts.py::test_smarts_doesnt_leak_tasks_after_reset
./examples/tests/test_examples.py::test_examples[e2_single_agent]
./smarts/env/tests/test_social_agent.py::test_social_agents_not_in_env_obs_keys /home/ubuntu/.venv/lib/python3.10/site-packages/pytest_benchmark/logger.py:39: PytestBenchmarkWarning: Benchmarks are automatically disabled because xdist plugin is active.Benchmarks cannot be performed reliably in a parallelized environment. warner(PytestBenchmarkWarning(text)) ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-8.3.5, pluggy-1.5.0 -- /home/ubuntu/.venv/bin/python3.10 cachedir: .pytest_cache benchmark: 5.1.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000) rootdir: /home/ubuntu/SMARTS configfile: pyproject.toml plugins: cov-6.1.1, forked-1.6.0, hydra-core-1.3.2, benchmark-5.1.0, xdist-3.6.1 10 workers [7 items]
scheduling tests via LoadScopeScheduling

smarts/core/tests/test_python_version.py::test_python_version smarts/core/tests/test_sensors.py::test_waypoints_sensor smarts/core/tests/test_sumo_version.py::test_sumo_version smarts/core/tests/test_dynamics_backend.py::test_set_pose examples/tests/test_examples.py::test_examples[e2_single_agent] smarts/env/tests/test_social_agent.py::test_social_agents_not_in_env_obs_keys smarts/core/tests/test_smarts.py::test_smarts_doesnt_leak_tasks_after_reset [gw0] [ 14%] PASSED smarts/core/tests/test_python_version.py::test_python_version [gw2] [ 28%] PASSED smarts/core/tests/test_dynamics_backend.py::test_set_pose [gw5] [ 42%] FAILED examples/tests/test_examples.py::test_examples[e2_single_agent] [gw1] [ 57%] PASSED smarts/core/tests/test_sumo_version.py::test_sumo_version [gw6] [ 71%] PASSED smarts/env/tests/test_social_agent.py::test_social_agents_not_in_env_obs_keys [gw3] [ 85%] PASSED smarts/core/tests/test_sensors.py::test_waypoints_sensor [gw4] [100%] PASSED smarts/core/tests/test_smarts.py::test_smarts_doesnt_leak_tasks_after_reset

=================================== FAILURES =================================== ________________________ test_examples[e2_single_agent] ________________________ [gw5] linux -- Python 3.10.12 /home/ubuntu/.venv/bin/python3.10 example = 'e2_single_agent'

@pytest.mark.parametrize(
    "example",
    [
        "e1_egoless",
        "e2_single_agent",
        "e3_multi_agent",
        "e4_environment_config",
        "e5_agent_zoo",
        "e6_agent_action_space",
        "e7_experiment_base",
        "e8_parallel_environment",
    ],
    # TODO: "ego_open_agent" and "human_in_the_loop" are causing aborts, fix later
)
def test_examples(example):
  current_example = import_module(example, "examples")

examples/tests/test_examples.py:35:


/usr/lib/python3.10/importlib/init.py:126: in import_module return _bootstrap._gcd_import(name[level:], package, level) :1050: in _gcd_import ??? :1027: in _find_and_load ??? :1006: in _find_and_load_unlocked ??? :688: in _load_unlocked ??? :883: in exec_module ??? :241: in _call_with_frames_removed ???


"""This example shows how you might run a SMARTS environment for single-agent work. SMARTS is
natively multi-agent so a single-agent wrapper is used."""
import argparse
import logging
import random
import sys
import warnings
from pathlib import Path
from typing import Final

logging.basicConfig(level=logging.ERROR)
warnings.filterwarnings("ignore")


import gymnasium as gym

SMARTS_REPO_PATH = Path(__file__).parents[1].absolute()
sys.path.insert(0, str(SMARTS_REPO_PATH))
from examples.tools.argument_parser import minimal_argument_parser
from smarts.core.agent import Agent
from smarts.core.agent_interface import AgentInterface, AgentType
from smarts.core.utils.episodes import episodes

from smarts.env.gymnasium.wrappers.single_agent import SingleAgent E File "/home/ubuntu/SMARTS/smarts/env/gymnasium/wrappers/single_agent.py", line 41 E agent_ids = list(env.unwrapped.agent_interfaces.keys()) # add .unwrapped E ^ E TabError: inconsistent use of tabs and spaces in indentation

examples/e2_single_agent.py:23: TabError -------- generated xml file: /home/ubuntu/SMARTS/sanity_test_result.xml -------- =========================== short test summary info ============================ FAILED examples/tests/test_examples.py::test_examples[e2_single_agent] ========================= 1 failed, 6 passed in 2.35s ========================== make: *** [Makefile:29:sanity-test] 错误 1

Version

System Information:

OS: Ubuntu 22.04

Python Version: 3.10.12

SMARTS Version: Latest clone from the GitHub repository

Additional Information:

The error happens around line 23 in examples/e2_single_agent.py.

When running make sanity-test, all other tests pass, except for the e2_single_agent test.

Could anyone please help me resolve this? Is there a known solution to this indentation error, or am I missing something important?

Operating System

No response

Problems

No response

Contributor guide