Repository: UKGovernmentBEIS/inspect_ai
Issue: AttributeError: 'TextualDisplay' object has no attribute 'app' while using `eval_async`
Root cause: Validation Gap

I am trying to run  `eval_async` function of the library but I am getting the above error.  The sample code to reproduce the error and the logs is given below. What could be potential fixes here?

**Code Sample:**
```python
import asyncio
from inspect_ai import Task, eval_async
from inspect_ai.dataset import example_dataset
from inspect_ai.scorer import model_graded_fact
from inspect_ai.solver import generate


async def run_evals():
    tasks = Task(
        dataset=example_dataset("security_guide"),
        solver=[generate()],
        scorer=model_graded_fact(),
    )
    eval_output = await eval_async(tasks, model="groq/gemma2-9b-it")
    return eval_output


async def main():
    result = await run_evals()
    print(result)


asyncio.run(main())

```



**Error Logs:**
```
Traceback (most recent call last):
  File "/Users/.pyenv/versions/3.11.4/lib/python3.11/runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/.pyenv/versions/3.11.4/lib/python3.11/runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "/Users/.vscode/extensions/ms-python.debugpy-2024.14.0-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 71, in <module>
    cli.main()
  File "/Users/.vscode/extensions/ms-python.debugpy-2024.14.0-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 501, in main
    run()
  File "/Users/.vscode/extensions/ms-python.debugpy-2024.14.0-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 351, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/Users/.vscode/extensions/ms-python.debugpy-2024.14.0-darwin-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 310, in run_path
    return _run_module_code(code, init_globals, run_name, pkg_name=pkg_name, script_name=fname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/.vscode/extensions/ms-python.debugpy-2024.14.0-darwin-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 127, in _run_module_code
    _run_code(code, mod_globals, init_globals, mod_name, mod_spec, pkg_name, script_name)
  File "/Users/.vscode/extensions/ms-python.debugpy-2024.14.0-darwin-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 118, in _run_code
    exec(code, run_globals)
  File "/Users/Documents/llm-application-backend/test.py", line 27, in <module>
    asyncio.run(main())
  File "/Users/.pyenv/versions/3.11.4/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Users/.pyenv/versions/3.11.4/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/.pyenv/versions/3.11.4/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/Documents/llm-application-backend/test.py", line 23, in main
    result = await run_evals()
             ^^^^^^^^^^^^^^^^^
  File "/Users/Documents/llm-application-backend/test.py", line 18, in run_evals
    eval_output = await eval_async(tasks, model="groq/gemma2-9b-it")
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Documents/venv/lib/python3.11/site-packages/inspect_ai/_eval/eval.py", line 407, in eval_async
    await eval_run(
  File "/Users/Documents/venv/lib/python3.11/site-packages/inspect_ai/_eval/run.py", line 214, in eval_run
    return await run_single(task_run_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Documents/venv/lib/python3.11/site-packages/inspect_ai/_eval/run.py", line 232, in run_single
    async with display().task_screen(task_specs(tasks), parallel=False) as screen:
  File "/Users/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 204, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Documents/venv/lib/python3.11/site-packages/inspect_ai/_display/textual/display.py", line 67, in task_screen
    async with self.app.task_screen(tasks, parallel) as task_screen:
               ^^^^^^^^
AttributeError: 'TextualDisplay' object has no attribute 'app'
```

Thanks for reporting this! Should be fixed here: https://github.com/UKGovernmentBEIS/inspect_ai/pull/1193

If you aren't able to sync to `main` then you can also fix this locally by adding this environment variable:

```python
os.environ["INSPECT_DISPLAY"] = "plain"
asyncio.run(main())
```


I was able to sync to main and get it working. Thanks for the quick fix.