Skip to content

New installation fails at atvremote wizard: RuntimeError: There is no current event loop in thread 'MainThread'. #2852

@botsmack

Description

@botsmack

What do you need help with?

I was having trouble with 0.17.0 failing after updating AppleTV to 26.5. So I deleted my venv and restarted from scratch, using Python 3.14.5. Nothing else was done other than what's listed below.


% python3.14 -m venv .venv/atvremote

% source .venv/atvremote/bin/activate

% pip list
Package Version
------- -------
pip     26.1.1

% python --version
Python 3.14.5

% python -m pip install pyatv
Collecting pyatv
  Using cached pyatv-0.17.0-py3-none-any.whl.metadata (6.1 kB)
Collecting aiohttp<5,>=3.8.3 (from pyatv)
  Using cached aiohttp-3.13.5-cp314-cp314-macosx_11_0_arm64.whl.metadata (8.1 kB)
Collecting cryptography>=44.0.1 (from pyatv)
  Using cached cryptography-48.0.0-cp311-abi3-macosx_10_9_universal2.whl.metadata (4.3 kB)
Collecting chacha20poly1305-reuseable>=0.13.2 (from pyatv)
  Using cached chacha20poly1305_reuseable-0.13.2-py3-none-any.whl.metadata (5.3 kB)
Collecting ifaddr>=0.1.7 (from pyatv)
  Using cached ifaddr-0.2.0-py3-none-any.whl.metadata (4.9 kB)
Collecting miniaudio>=1.45 (from pyatv)
  Using cached miniaudio-1.71-cp314-cp314-macosx_11_0_arm64.whl.metadata (25 kB)
Collecting protobuf>=6.31.1 (from pyatv)
  Using cached protobuf-7.34.1-cp310-abi3-macosx_10_9_universal2.whl.metadata (595 bytes)
Collecting pydantic>=2.0.0 (from pyatv)
  Using cached pydantic-2.13.4-py3-none-any.whl.metadata (109 kB)
Collecting requests>=2.30.0 (from pyatv)
  Using cached requests-2.34.2-py3-none-any.whl.metadata (4.8 kB)
Collecting srptools>=0.2.0 (from pyatv)
  Using cached srptools-1.0.1-py2.py3-none-any.whl.metadata (6.4 kB)
Collecting tabulate>=0.9.0 (from pyatv)
  Using cached tabulate-0.10.0-py3-none-any.whl.metadata (40 kB)
Collecting tinytag>=1.10.0 (from pyatv)
  Using cached tinytag-2.2.1-py3-none-any.whl.metadata (20 kB)
Collecting zeroconf>=0.129.0 (from pyatv)
  Using cached zeroconf-0.149.7-cp314-cp314-macosx_11_0_arm64.whl.metadata (6.2 kB)
Collecting aiohappyeyeballs>=2.5.0 (from aiohttp<5,>=3.8.3->pyatv)
  Using cached aiohappyeyeballs-2.6.1-py3-none-any.whl.metadata (5.9 kB)
Collecting aiosignal>=1.4.0 (from aiohttp<5,>=3.8.3->pyatv)
  Using cached aiosignal-1.4.0-py3-none-any.whl.metadata (3.7 kB)
Collecting attrs>=17.3.0 (from aiohttp<5,>=3.8.3->pyatv)
  Using cached attrs-26.1.0-py3-none-any.whl.metadata (8.8 kB)
Collecting frozenlist>=1.1.1 (from aiohttp<5,>=3.8.3->pyatv)
  Using cached frozenlist-1.8.0-cp314-cp314-macosx_11_0_arm64.whl.metadata (20 kB)
Collecting multidict<7.0,>=4.5 (from aiohttp<5,>=3.8.3->pyatv)
  Using cached multidict-6.7.1-cp314-cp314-macosx_11_0_arm64.whl.metadata (5.3 kB)
Collecting propcache>=0.2.0 (from aiohttp<5,>=3.8.3->pyatv)
  Using cached propcache-0.5.2-cp314-cp314-macosx_11_0_arm64.whl.metadata (16 kB)
Collecting yarl<2.0,>=1.17.0 (from aiohttp<5,>=3.8.3->pyatv)
  Using cached yarl-1.23.0-cp314-cp314-macosx_11_0_arm64.whl.metadata (79 kB)
Collecting idna>=2.0 (from yarl<2.0,>=1.17.0->aiohttp<5,>=3.8.3->pyatv)
  Using cached idna-3.15-py3-none-any.whl.metadata (7.7 kB)
Collecting cffi>=2.0.0 (from cryptography>=44.0.1->pyatv)
  Using cached cffi-2.0.0-cp314-cp314-macosx_11_0_arm64.whl.metadata (2.6 kB)
Collecting pycparser (from cffi>=2.0.0->cryptography>=44.0.1->pyatv)
  Using cached pycparser-3.0-py3-none-any.whl.metadata (8.2 kB)
Collecting annotated-types>=0.6.0 (from pydantic>=2.0.0->pyatv)
  Using cached annotated_types-0.7.0-py3-none-any.whl.metadata (15 kB)
Collecting pydantic-core==2.46.4 (from pydantic>=2.0.0->pyatv)
  Using cached pydantic_core-2.46.4-cp314-cp314-macosx_11_0_arm64.whl.metadata (6.6 kB)
Collecting typing-extensions>=4.14.1 (from pydantic>=2.0.0->pyatv)
  Using cached typing_extensions-4.15.0-py3-none-any.whl.metadata (3.3 kB)
Collecting typing-inspection>=0.4.2 (from pydantic>=2.0.0->pyatv)
  Using cached typing_inspection-0.4.2-py3-none-any.whl.metadata (2.6 kB)
Collecting charset_normalizer<4,>=2 (from requests>=2.30.0->pyatv)
  Using cached charset_normalizer-3.4.7-cp314-cp314-macosx_10_15_universal2.whl.metadata (40 kB)
Collecting urllib3<3,>=1.26 (from requests>=2.30.0->pyatv)
  Using cached urllib3-2.7.0-py3-none-any.whl.metadata (6.9 kB)
Collecting certifi>=2023.5.7 (from requests>=2.30.0->pyatv)
  Using cached certifi-2026.4.22-py3-none-any.whl.metadata (2.5 kB)
Collecting six (from srptools>=0.2.0->pyatv)
  Using cached six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB)
Using cached pyatv-0.17.0-py3-none-any.whl (462 kB)
Using cached aiohttp-3.13.5-cp314-cp314-macosx_11_0_arm64.whl (499 kB)
Using cached multidict-6.7.1-cp314-cp314-macosx_11_0_arm64.whl (43 kB)
Using cached yarl-1.23.0-cp314-cp314-macosx_11_0_arm64.whl (86 kB)
Using cached aiohappyeyeballs-2.6.1-py3-none-any.whl (15 kB)
Using cached aiosignal-1.4.0-py3-none-any.whl (7.5 kB)
Using cached attrs-26.1.0-py3-none-any.whl (67 kB)
Using cached chacha20poly1305_reuseable-0.13.2-py3-none-any.whl (8.6 kB)
Using cached cryptography-48.0.0-cp311-abi3-macosx_10_9_universal2.whl (8.0 MB)
Using cached cffi-2.0.0-cp314-cp314-macosx_11_0_arm64.whl (181 kB)
Using cached frozenlist-1.8.0-cp314-cp314-macosx_11_0_arm64.whl (49 kB)
Using cached idna-3.15-py3-none-any.whl (72 kB)
Using cached ifaddr-0.2.0-py3-none-any.whl (12 kB)
Using cached miniaudio-1.71-cp314-cp314-macosx_11_0_arm64.whl (351 kB)
Using cached propcache-0.5.2-cp314-cp314-macosx_11_0_arm64.whl (54 kB)
Using cached protobuf-7.34.1-cp310-abi3-macosx_10_9_universal2.whl (429 kB)
Using cached pydantic-2.13.4-py3-none-any.whl (472 kB)
Using cached pydantic_core-2.46.4-cp314-cp314-macosx_11_0_arm64.whl (2.0 MB)
Using cached annotated_types-0.7.0-py3-none-any.whl (13 kB)
Using cached requests-2.34.2-py3-none-any.whl (73 kB)
Using cached charset_normalizer-3.4.7-cp314-cp314-macosx_10_15_universal2.whl (309 kB)
Using cached urllib3-2.7.0-py3-none-any.whl (131 kB)
Using cached certifi-2026.4.22-py3-none-any.whl (135 kB)
Using cached srptools-1.0.1-py2.py3-none-any.whl (13 kB)
Using cached tabulate-0.10.0-py3-none-any.whl (39 kB)
Using cached tinytag-2.2.1-py3-none-any.whl (32 kB)
Using cached typing_extensions-4.15.0-py3-none-any.whl (44 kB)
Using cached typing_inspection-0.4.2-py3-none-any.whl (14 kB)
Using cached zeroconf-0.149.7-cp314-cp314-macosx_11_0_arm64.whl (1.7 MB)
Using cached pycparser-3.0-py3-none-any.whl (48 kB)
Using cached six-1.17.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: ifaddr, zeroconf, urllib3, typing-extensions, tinytag, tabulate, six, pycparser, protobuf, propcache, multidict, idna, frozenlist, charset_normalizer, certifi, attrs, annotated-types, aiohappyeyeballs, yarl, typing-inspection, srptools, requests, pydantic-core, cffi, aiosignal, pydantic, miniaudio, cryptography, aiohttp, chacha20poly1305-reuseable, pyatv
Successfully installed aiohappyeyeballs-2.6.1 aiohttp-3.13.5 aiosignal-1.4.0 annotated-types-0.7.0 attrs-26.1.0 certifi-2026.4.22 cffi-2.0.0 chacha20poly1305-reuseable-0.13.2 charset_normalizer-3.4.7 cryptography-48.0.0 frozenlist-1.8.0 idna-3.15 ifaddr-0.2.0 miniaudio-1.71 multidict-6.7.1 propcache-0.5.2 protobuf-7.34.1 pyatv-0.17.0 pycparser-3.0 pydantic-2.13.4 pydantic-core-2.46.4 requests-2.34.2 six-1.17.0 srptools-1.0.1 tabulate-0.10.0 tinytag-2.2.1 typing-extensions-4.15.0 typing-inspection-0.4.2 urllib3-2.7.0 yarl-1.23.0 zeroconf-0.149.7

% atvremote wizard
Traceback (most recent call last):
  File "/Users/richard/.venv/atvremote/bin/atvremote", line 6, in <module>
    sys.exit(main())
             ~~~~^^
  File "/Users/richard/.venv/atvremote/lib/python3.14/site-packages/pyatv/scripts/atvremote.py", line 1022, in main
    loop = asyncio.get_event_loop()
  File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/asyncio/events.py", line 715, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
                       % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'MainThread'.

% pip list
Package                    Version
-------------------------- ---------
aiohappyeyeballs           2.6.1
aiohttp                    3.13.5
aiosignal                  1.4.0
annotated-types            0.7.0
attrs                      26.1.0
certifi                    2026.4.22
cffi                       2.0.0
chacha20poly1305-reuseable 0.13.2
charset-normalizer         3.4.7
cryptography               48.0.0
frozenlist                 1.8.0
idna                       3.15
ifaddr                     0.2.0
miniaudio                  1.71
multidict                  6.7.1
pip                        26.1.1
propcache                  0.5.2
protobuf                   7.34.1
pyatv                      0.17.0
pycparser                  3.0
pydantic                   2.13.4
pydantic_core              2.46.4
requests                   2.34.2
six                        1.17.0
srptools                   1.0.1
tabulate                   0.10.0
tinytag                    2.2.1
typing_extensions          4.15.0
typing-inspection          0.4.2
urllib3                    2.7.0
yarl                       1.23.0
zeroconf                   0.149.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions