pyatv icon indicating copy to clipboard operation
pyatv copied to clipboard

After installing, can't operate the scan command

Open nitaybz opened this issue 2 years ago • 9 comments

Describe the bug

when trying to run scan command I run into (seems like) dependencies issue. The lib is installed in a homebridge image on a RPI 4

Error log

pi@homebridge:~$ atvremote scan
Traceback (most recent call last):
  File "/usr/local/bin/atvremote", line 5, in <module>
    from pyatv.scripts.atvremote import main
  File "/usr/local/lib/python3.9/dist-packages/pyatv/__init__.py", line 18, in <module>
    from pyatv.core.scan import (
  File "/usr/local/lib/python3.9/dist-packages/pyatv/core/scan.py", line 32, in <module>
    from pyatv.helpers import get_unique_id
  File "/usr/local/lib/python3.9/dist-packages/pyatv/helpers.py", line 6, in <module>
    import miniaudio
  File "/home/pi/.local/lib/python3.9/site-packages/miniaudio.py", line 22, in <module>
    from _miniaudio import ffi, lib
ImportError: /home/pi/.local/lib/python3.9/site-packages/_miniaudio.abi3.so: undefined symbol: __atomic_load_8

How to reproduce the bug?

pip3 install pyatv atvremote scan

What is expected behavior?

I would expect the scan to work :)

Operating System

Linux (Raspberry Pi 4 B+)

Python

3.9

pyatv

0.10.0

Device

Apple TV 4 tvOS 15.1

Additional context

nothing more

nitaybz avatar Jun 22 '22 15:06 nitaybz

This sounds like some incompatibility with the wheels from miniaudio. Try re-building miniaudio manually like this:

pip uninstall miniaudio
pip install --no-binary :all: miniaudio

Hopefully that will solve your issues.

postlund avatar Jun 25 '22 17:06 postlund

Unfortunately I'm getting the same error... I verified it's uninstalled and than installed again (using sudo on rpi), but still getting the same error

nitaybz avatar Jun 25 '22 20:06 nitaybz

eventually I succeeded by trying to install an older version of miniaudio with: sudo pip install --no-binary :all: miniaudio==1.40

nitaybz avatar Jun 25 '22 21:06 nitaybz

Have the same issue after updating a Raspberry Pi to Debian buster. Reinstalling miniaudio like @postlund suggested doesn't work for me.

sebbo@raspberrypi ~ ❯❯❯ pip3 uninstall miniaudio                                               ✘ 1 
Uninstalling miniaudio-1.51:
  Would remove:
    /usr/local/lib/python3.7/dist-packages/_miniaudio.abi3.so
    /usr/local/lib/python3.7/dist-packages/miniaudio-1.51.egg-info
    /usr/local/lib/python3.7/dist-packages/miniaudio.py
Proceed (y/n)? y
  Successfully uninstalled miniaudio-1.51

sebbo@raspberrypi ~ ❯❯❯ pip3 install --no-binary :all: miniaudio
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting miniaudio
  Using cached https://files.pythonhosted.org/packages/25/77/895bdfa79d8522f38f4545802f4cfd75fd97bfaa265cd7e9f987d66399f8/miniaudio-1.51.tar.gz
Requirement already satisfied: cffi>=1.12.0 in /usr/local/lib/python3.7/dist-packages (from miniaudio) (1.15.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi>=1.12.0->miniaudio) (2.21)
Skipping bdist_wheel for miniaudio, due to binaries being disabled for it.
Installing collected packages: miniaudio
  Running setup.py install for miniaudio ... done
Successfully installed miniaudio-1.51


sebbo@raspberrypi ~ ❯❯❯ atvremote scan
Traceback (most recent call last):
  File "/usr/local/bin/atvremote", line 6, in <module>
    from pyatv.scripts.atvremote import main
  File "/usr/local/lib/python3.7/dist-packages/pyatv/__init__.py", line 17, in <module>
    from pyatv.core.scan import BaseScanner, MulticastMdnsScanner, UnicastMdnsScanner
  File "/usr/local/lib/python3.7/dist-packages/pyatv/core/scan.py", line 27, in <module>
    from pyatv.helpers import get_unique_id
  File "/usr/local/lib/python3.7/dist-packages/pyatv/helpers.py", line 6, in <module>
    import miniaudio
  File "/usr/local/lib/python3.7/dist-packages/miniaudio.py", line 22, in <module>
    from _miniaudio import ffi, lib
ImportError: /usr/local/lib/python3.7/dist-packages/_miniaudio.abi3.so: undefined symbol: __atomic_load_8

Also tried reinstalling pyatv again, but that didn't really help either. Is the message below about charset-normalizer relevant?

sebbo@raspberrypi ~ ❯❯❯ pip3 install pyatv
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyatv
  Downloading https://files.pythonhosted.org/packages/dd/a3/94954eaa67ace113036051bb908c85f0d2749a0cb84c5c9cd28431c1be4e/pyatv-0.10.0-py3-none-any.whl (399kB)
    100% |████████████████████████████████| 399kB 313kB/s 
Collecting aiohttp<5,>=3.1.0 (from pyatv)
  Using cached https://www.piwheels.org/simple/aiohttp/aiohttp-3.8.1-cp37-cp37m-linux_armv7l.whl
Collecting srptools>=0.2.0 (from pyatv)
  Using cached https://files.pythonhosted.org/packages/8d/b8/3f935d7f7d6bc25a88859beb0a6e246313012a12ae4844665322f771a5cb/srptools-1.0.1-py2.py3-none-any.whl
Collecting zeroconf>=0.38.1 (from pyatv)
  Using cached https://files.pythonhosted.org/packages/c2/43/140e2fefeed540a6747020c29eebcb2a770cee474026b644bd2c4156d166/zeroconf-0.38.7-py3-none-any.whl
Collecting miniaudio>=1.45 (from pyatv)
  Using cached https://www.piwheels.org/simple/miniaudio/miniaudio-1.51-cp37-cp37m-linux_armv7l.whl
Collecting mediafile>=0.8.1 (from pyatv)
  Using cached https://files.pythonhosted.org/packages/75/73/51c21b2efc9f563723ab522dac49021c4a228516a335f9726620ba610ac2/mediafile-0.9.0-py3-none-any.whl
Collecting bitarray>=2.1.2 (from pyatv)
  Using cached https://www.piwheels.org/simple/bitarray/bitarray-2.5.1-cp37-cp37m-linux_armv7l.whl
Collecting protobuf<4,>=3.19.1 (from pyatv)
  Using cached https://files.pythonhosted.org/packages/ef/c8/2e7f7feaf804b7206e6cc8fa3f0f49834a78f7cb127813d2c45e42d5f7bf/protobuf-3.20.1-py2.py3-none-any.whl
Collecting requests>=2.23.0 (from pyatv)
  Downloading https://files.pythonhosted.org/packages/41/5b/2209eba8133fc081d3ffff02e1f6376e3117e52bb16f674721a83e67e68e/requests-2.28.0-py3-none-any.whl (62kB)
    100% |████████████████████████████████| 71kB 1.0MB/s 
Collecting ifaddr>=0.1.7 (from pyatv)
  Using cached https://files.pythonhosted.org/packages/9c/1f/19ebc343cc71a7ffa78f17018535adc5cbdd87afb31d7c34874680148b32/ifaddr-0.2.0-py3-none-any.whl
Requirement already satisfied: cryptography>=2.6 in /usr/lib/python3/dist-packages (from pyatv) (2.6.1)
Collecting multidict<7.0,>=4.5 (from aiohttp<5,>=3.1.0->pyatv)
  Using cached https://www.piwheels.org/simple/multidict/multidict-6.0.2-cp37-cp37m-linux_armv7l.whl
Collecting frozenlist>=1.1.1 (from aiohttp<5,>=3.1.0->pyatv)
  Using cached https://www.piwheels.org/simple/frozenlist/frozenlist-1.3.0-cp37-cp37m-linux_armv7l.whl
Collecting charset-normalizer<3.0,>=2.0 (from aiohttp<5,>=3.1.0->pyatv)
  Using cached https://files.pythonhosted.org/packages/94/69/64b11e8c2fb21f08634468caef885112e682b0ebe2908e74d3616eb1c113/charset_normalizer-2.1.0-py3-none-any.whl
Collecting async-timeout<5.0,>=4.0.0a3 (from aiohttp<5,>=3.1.0->pyatv)
  Using cached https://files.pythonhosted.org/packages/d6/c1/8991e7c5385b897b8c020cdaad718c5b087a6626d1d11a23e1ea87e325a7/async_timeout-4.0.2-py3-none-any.whl
Collecting yarl<2.0,>=1.0 (from aiohttp<5,>=3.1.0->pyatv)
  Using cached https://www.piwheels.org/simple/yarl/yarl-1.7.2-cp37-cp37m-linux_armv7l.whl
Collecting attrs>=17.3.0 (from aiohttp<5,>=3.1.0->pyatv)
  Using cached https://files.pythonhosted.org/packages/be/be/7abce643bfdf8ca01c48afa2ddf8308c2308b0c3b239a44e57d020afa0ef/attrs-21.4.0-py2.py3-none-any.whl
Collecting asynctest==0.13.0; python_version < "3.8" (from aiohttp<5,>=3.1.0->pyatv)
  Using cached https://files.pythonhosted.org/packages/e8/b6/8d17e169d577ca7678b11cd0d3ceebb0a6089a7f4a2de4b945fe4b1c86db/asynctest-0.13.0-py3-none-any.whl
Collecting aiosignal>=1.1.2 (from aiohttp<5,>=3.1.0->pyatv)
  Using cached https://files.pythonhosted.org/packages/3b/87/fe94898f2d44a93a35d5aa74671ed28094d80753a1113d68b799fab6dc22/aiosignal-1.2.0-py3-none-any.whl
Collecting typing-extensions>=3.7.4; python_version < "3.8" (from aiohttp<5,>=3.1.0->pyatv)
  Using cached https://files.pythonhosted.org/packages/75/e1/932e06004039dd670c9d5e1df0cd606bf46e29a28e65d5bb28e894ea29c9/typing_extensions-4.2.0-py3-none-any.whl
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from srptools>=0.2.0->pyatv) (1.12.0)
Collecting cffi>=1.12.0 (from miniaudio>=1.45->pyatv)
  Using cached https://www.piwheels.org/simple/cffi/cffi-1.15.0-cp37-cp37m-linux_armv7l.whl
Collecting mutagen>=1.45 (from mediafile>=0.8.1->pyatv)
  Using cached https://files.pythonhosted.org/packages/16/b3/f7aa8edf2ff4495116f95fd442b2a346aa55d1d46313143c8814886dbcdb/mutagen-1.45.1-py3-none-any.whl
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests>=2.23.0->pyatv) (1.24.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests>=2.23.0->pyatv) (2018.8.24)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests>=2.23.0->pyatv) (2.6)
Collecting pycparser (from cffi>=1.12.0->miniaudio>=1.45->pyatv)
  Using cached https://files.pythonhosted.org/packages/62/d5/5f610ebe421e85889f2e55e33b7f9a6795bd982198517d912eb1c76e1a53/pycparser-2.21-py2.py3-none-any.whl
requests 2.28.0 has requirement charset-normalizer~=2.0.0, but you'll have charset-normalizer 2.1.0 which is incompatible.
Installing collected packages: multidict, frozenlist, charset-normalizer, typing-extensions, async-timeout, yarl, attrs, asynctest, aiosignal, aiohttp, srptools, ifaddr, zeroconf, pycparser, cffi, miniaudio, mutagen, mediafile, bitarray, protobuf, requests, pyatv
  Found existing installation: requests 2.21.0
    Not uninstalling requests at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'requests'. No files were found to uninstall.
Successfully installed aiohttp-3.8.1 aiosignal-1.2.0 async-timeout-4.0.2 asynctest-0.13.0 attrs-21.4.0 bitarray-2.5.1 cffi-1.15.0 charset-normalizer-2.1.0 frozenlist-1.3.0 ifaddr-0.2.0 mediafile-0.9.0 miniaudio-1.51 multidict-6.0.2 mutagen-1.45.1 protobuf-3.20.1 pyatv-0.10.0 pycparser-2.21 requests-2.28.0 srptools-1.0.1 typing-extensions-4.2.0 yarl-1.7.2 zeroconf-0.38.7

sebbo2002 avatar Jun 25 '22 21:06 sebbo2002

@sebbo2002 try to uninstall miniaudio and than install with: sudo pip install --no-binary :all: miniaudio==1.40

nitaybz avatar Jun 25 '22 21:06 nitaybz

sudo pip install --no-binary :all: miniaudio==1.40

@nitaybz That worked wonderfully, thanks for the tip ❤️

sebbo2002 avatar Jun 25 '22 21:06 sebbo2002

does it means that requirements.txt must be adapted with miniaudio 1.40 ???

NebzHB avatar Jul 10 '22 19:07 NebzHB

No, this is a pyminiaudio bug affecting certain configurations. There's an issue for it here: https://github.com/irmen/pyminiaudio/issues/52 A new version of the library must be released with a fix.

postlund avatar Jul 10 '22 20:07 postlund

@postlund https://github.com/irmen/pyminiaudio/releases/tag/v1.52 has been released :)

NebzHB avatar Aug 14 '22 06:08 NebzHB

Should be fixed by now.

postlund avatar Jun 12 '23 19:06 postlund