Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Problem #2442

Open
Jon-G-Max opened this issue Jul 17, 2024 · 8 comments
Open

Install Problem #2442

Jon-G-Max opened this issue Jul 17, 2024 · 8 comments
Labels

Comments

@Jon-G-Max
Copy link

What do you need help with?

Im sure this is a rookie error but do you have any idea why these errors are occurring? see errors below...

atvremote wizard 
Looking for devices...
Found the following devices:
    Name                       Model                Address
--  -------------------------  -------------------  -------------
 1  Grovers M1Max (2021)       MacBookPro18,2       192.168.1.151
 2  Dining Room                HomePod              192.168.1.180
 3  Basement                   Apple TV 4K (gen 3)  192.168.1.172
 4  MRX 540-42B9FA             MRX 540              192.168.1.183
 5  SONY XR-55A95K             XR-55A95K            192.168.1.191
 6  Living Room -Old Apple TV  Apple TV 4           192.168.1.153
 7  Family Room                Apple TV 4K (gen 3)  192.168.1.170
 8  Server 2024                Mac14,14             192.168.1.250
 9  Norma's MacBook Air        MacBookAir10,1       192.168.1.77
10  Server 2024                Mac14,14             192.168.1.232
Enter index of device to set up (q to quit): 7
Starting to set up Family Room
Starting to pair Protocol.Companion
Enter PIN on screen: 7308
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/support/__init__.py", line 71, in error_handler
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/protocols/companion/auth.py", line 99, in finish_pairing
    encrypted_data = self.srp.step3(name=display_name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/auth/hap_srp.py", line 202, in step3
    chacha = chacha20.Chacha20Cipher(self._session_key, self._session_key)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/support/chacha20.py", line 14, in __init__
    self._enc_out = ChaCha20Poly1305(out_key)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/chacha20poly1305_reuseable/__init__.py", line 82, in __init__
    if not AEAD_CIPHER_SUPPORTED(TEST_CIPHER):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 572, in aead_cipher_supported
    return aead._aead_cipher_supported(self, cipher)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/aead.py", line 22, in _aead_cipher_supported
    cipher_name = _evp_cipher_cipher_name(cipher)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/aead.py", line 66, in _evp_cipher_cipher_name
    assert isinstance(cipher, AESGCM)
AssertionError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/scripts/atvremote.py", line 978, in _run_application
    return await cli_handler(loop)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/scripts/atvremote.py", line 717, in cli_handler
    return await _exec_command(glob_cmds, args.command[0], print_result=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/scripts/atvremote.py", line 945, in _exec_command
    value = await tmp(*args)
            ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/scripts/atvremote.py", line 283, in wizard
    await self._wizard_pair(conf, service)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/scripts/atvremote.py", line 355, in _wizard_pair
    await pairing.finish()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/protocols/companion/pairing.py", line 58, in finish
    await error_handler(
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/support/__init__.py", line 77, in error_handler
    raise fallback(str(ex)) from ex
pyatv.exceptions.PairingError

>>> An error occurred, full stack trace above
2024-07-17 15:08:24 ERROR [asyncio]: Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x104aa5f10>
@postlund
Copy link
Owner

Based on this:

^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/aead.py", line 66, in _evp_cipher_cipher_name
    assert isinstance(cipher, AESGCM)
AssertionError

I assume OpenSSL is built without support AES GCM. This is the default installation of Python in macOS, right? Not installed via brew?

@Jon-G-Max
Copy link
Author

This is macOS Sonoma 14.5. Not sure what comes preinstalled as default... Ran these commands.... Is there a URL you can suggest to install missing components?

MyHost ~ % openssl version
LibreSSL 3.3.6
MyHost ~ % openssl enc -help 2>&1 | grep gcm
 -aes-128-ecb              -aes-128-gcm              -aes-128-ofb             
 -aes-192-ctr              -aes-192-ecb              -aes-192-gcm             
 -aes-256-ctr              -aes-256-ecb              -aes-256-gcm             

@postlund
Copy link
Owner

How did you install pyatv? I would recommend installing in a virtual environment. Looks to me like the cryptography library is quite old.

@postlund
Copy link
Owner

Can you try to install from master and see if you notice any difference?

@Jon-G-Max
Copy link
Author

I apologize but I'm really a newbie to open source, command line development. I have a stock MacBook Pro running Sonoma 14.5. Is there a step by step instruction on how to install from master ? My install used pip. I would really love to get this running but I don't want to waste anyone's time.

@postlund
Copy link
Owner

I'm planning on making a new release quite soon, just waiting for some things to land. I'll let you know when it's ready, then you can just upgrade with pip.

@Jon-G-Max
Copy link
Author

Any updates? running "pip install pyatv" followed by "atvremote wizard" still results in the same errors.

I'm trying to use a Mac to control an Apple TV GUI.

Enter index of device to set up (q to quit): 10
Starting to set up The Wall
Starting to pair Protocol.Companion
Enter PIN on screen: 6635
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/support/__init__.py", line 71, in error_handler
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/protocols/companion/auth.py", line 99, in finish_pairing
    encrypted_data = self.srp.step3(name=display_name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/auth/hap_srp.py", line 202, in step3
    chacha = chacha20.Chacha20Cipher(self._session_key, self._session_key)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/support/chacha20.py", line 14, in __init__
    self._enc_out = ChaCha20Poly1305(out_key)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/chacha20poly1305_reuseable/__init__.py", line 82, in __init__
    if not AEAD_CIPHER_SUPPORTED(TEST_CIPHER):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 572, in aead_cipher_supported
    return aead._aead_cipher_supported(self, cipher)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/aead.py", line 22, in _aead_cipher_supported
    cipher_name = _evp_cipher_cipher_name(cipher)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/aead.py", line 66, in _evp_cipher_cipher_name
    assert isinstance(cipher, AESGCM)
AssertionError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/scripts/atvremote.py", line 978, in _run_application
    return await cli_handler(loop)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/scripts/atvremote.py", line 717, in cli_handler
    return await _exec_command(glob_cmds, args.command[0], print_result=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/scripts/atvremote.py", line 945, in _exec_command
    value = await tmp(*args)
            ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/scripts/atvremote.py", line 283, in wizard
    await self._wizard_pair(conf, service)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/scripts/atvremote.py", line 355, in _wizard_pair
    await pairing.finish()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/protocols/companion/pairing.py", line 58, in finish
    await error_handler(
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyatv/support/__init__.py", line 77, in error_handler
    raise fallback(str(ex)) from ex
pyatv.exceptions.PairingError

>>> An error occurred, full stack trace above
2024-09-05 14:29:12 ERROR [asyncio]: Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x105e0c5f0>

@postlund
Copy link
Owner

postlund commented Sep 6, 2024

No progress I'm afraid. My recommendation is to instal home-brew and install python from there instead. That's what I do and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants