question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Display exception when creating multiple SMARTS instances

See original GitHub issue

I encounter the “Display is not found” exception when trying to create multiple SMARTS instances:

截屏2020-11-19 10 19 23

To reproduce:

train_env = gym.make(
    "smarts.env:hiway-v0",
    scenarios=scenarios,
    agent_specs={AGENT_ID: agent_spec},
    headless=headless,
    visdom=False,
    timestep_sec=0.1,
    sumo_headless=True,
    seed=seed,
    # envision_record_data_replay_path="./data_replay",
)

test_env = gym.make(
    "smarts.env:hiway-v0",
    scenarios=scenarios,
    agent_specs={AGENT_ID: agent_spec},
    headless=headless,
    visdom=False,
    timestep_sec=0.1,
    sumo_headless=True,
    seed=seed,
    # envision_record_data_replay_path="./data_replay",
)

Development Environment:

OS: Ubuntu 16.04

Python: 3.7.4

SUMO: 1.7.0

SMARTS: 0.4.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Gamenotcommented, Nov 19, 2020

Hello @zbzhu99 , this is a known issue. SMARTS uses a few dependencies that have the requirement for a single instance in a process. In order to use another SMARTS instance in the same thread, the previous needs to be destroyed, or run on another process.

There is an example/multi_instance.py that shows one way to be able use more than one smarts environment using ray.

https://github.com/huawei-noah/SMARTS/blob/master/examples/multi_instance.py#L68-L162

2reactions
davidrusucommented, Dec 8, 2020

@alek5k Yeah we did hit that one with one of our users as well

Maybe you can find something of use from the other configuration options we tuned here:

https://github.com/huawei-noah/SMARTS/blob/master/smarts/core/smarts.py#L62-L68

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - How do I determine what type of exception occurred?
Inside except block the exception is available through sys. exc_info() function – This function returns a tuple of three values that give information...
Read more >
How to Catch Multiple Exceptions in Python - Rollbar
In Python, try-except blocks can be used to catch and respond to one or multiple exceptions. In cases where a process raises more...
Read more >
Top 10 Selenium Exceptions and How To Handle These ...
Handling Exceptions in Selenium WebDriver - In this tutorial we will learn about types of exceptions and how to handle top 10 most...
Read more >
Modern C++ best practices for exceptions and error handling
In modern C++, in most scenarios, the preferred way to report and handle both logic errors and runtime errors is to use exceptions....
Read more >
Exceptions and Error Handling, C++ FAQ - Standard C++
Exception handling seems to make my life more difficult; that must mean exception handling itself is bad; clearly I'm not the problem, right??...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found