Closed khiner closed 2 years ago
That's weird, CI is passing on the binary wheels. Is this the latest version of pylibsrtp from pypi?
Thanks for getting back quickly. It looks like it is - 0.7.0
:
$ pip show pylibsrtp
Name: pylibsrtp
Version: 0.7.0
Summary: Python wrapper around the libsrtp library
Home-page: https://github.com/aiortc/pylibsrtp
Author: Jeremy Lainé
Author-email: jeremy.laine@m4x.org
License: BSD
Location: /Users/khiner/.pyenv/versions/3.10.1/lib/python3.10/site-packages
Requires: cffi
Required-by: aiortc
I've been working through other local env issues that may possibly be contributing to these issues. I ended up nuking and reinstalling pretty much everything, removing a bunch of configuration that I may not need anymore etc. (setting up a new computer and all that goes with it when switching from a dev machine that's been used for years).
Anyway, I ran into something that I probably should have taken note of sooner. I cannot install aiortc
from pip without brew install
ing the requirements under the build from source instructions.
Full output:
$ pip install aiortc
Collecting aiortc
Using cached aiortc-1.2.1.tar.gz (1.2 MB)
Preparing metadata (setup.py) ... done
Collecting aioice<0.8.0,>=0.7.5
Using cached aioice-0.7.5-py3-none-any.whl (23 kB)
Collecting av<9.0.0,>=8.0.0
Using cached av-8.1.0.tar.gz (2.4 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: cffi>=1.0.0 in ./.pyenv/versions/3.10.1/lib/python3.10/site-packages (from aiortc) (1.15.0)
Requirement already satisfied: cryptography>=2.2 in ./.pyenv/versions/3.10.1/lib/python3.10/site-packages (from aiortc) (36.0.1)
Requirement already satisfied: google-crc32c>=1.1 in ./.pyenv/versions/3.10.1/lib/python3.10/site-packages (from aiortc) (1.3.0)
Requirement already satisfied: pyee>=6.0.0 in ./.pyenv/versions/3.10.1/lib/python3.10/site-packages (from aiortc) (8.2.2)
Requirement already satisfied: pylibsrtp>=0.5.6 in ./.pyenv/versions/3.10.1/lib/python3.10/site-packages (from aiortc) (0.7.0)
Requirement already satisfied: netifaces in ./.pyenv/versions/3.10.1/lib/python3.10/site-packages (from aioice<0.8.0,>=0.7.5->aiortc) (0.11.0)
Requirement already satisfied: dnspython in ./.pyenv/versions/3.10.1/lib/python3.10/site-packages (from aioice<0.8.0,>=0.7.5->aiortc) (2.1.0)
Requirement already satisfied: pycparser in ./.pyenv/versions/3.10.1/lib/python3.10/site-packages (from cffi>=1.0.0->aiortc) (2.21)
Building wheels for collected packages: aiortc, av
Building wheel for aiortc (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/khiner/.pyenv/versions/3.10.1/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/aiortc_e2fd54dbba5747d1b52a36a320d3105c/setup.py'"'"'; __file__='"'"'/private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/aiortc_e2fd54dbba5747d1b52a36a320d3105c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-wheel-ws8a0nod
cwd: /private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/aiortc_e2fd54dbba5747d1b52a36a320d3105c/
Complete output (53 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-12.1-arm64-3.10
creating build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcsctptransport.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcconfiguration.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcrtpparameters.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcdtlstransport.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcdatachannel.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/mediastreams.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/jitterbuffer.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcrtpsender.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/events.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rate.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/clock.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcpeerconnection.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/__init__.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/about.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcicetransport.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcrtpreceiver.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/utils.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/stats.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/exceptions.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/sdp.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcsessiondescription.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtp.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
copying src/aiortc/rtcrtptransceiver.py -> build/lib.macosx-12.1-arm64-3.10/aiortc
creating build/lib.macosx-12.1-arm64-3.10/aiortc/codecs
copying src/aiortc/codecs/h264.py -> build/lib.macosx-12.1-arm64-3.10/aiortc/codecs
copying src/aiortc/codecs/g711.py -> build/lib.macosx-12.1-arm64-3.10/aiortc/codecs
copying src/aiortc/codecs/__init__.py -> build/lib.macosx-12.1-arm64-3.10/aiortc/codecs
copying src/aiortc/codecs/opus.py -> build/lib.macosx-12.1-arm64-3.10/aiortc/codecs
copying src/aiortc/codecs/vpx.py -> build/lib.macosx-12.1-arm64-3.10/aiortc/codecs
copying src/aiortc/codecs/base.py -> build/lib.macosx-12.1-arm64-3.10/aiortc/codecs
creating build/lib.macosx-12.1-arm64-3.10/aiortc/contrib
copying src/aiortc/contrib/media.py -> build/lib.macosx-12.1-arm64-3.10/aiortc/contrib
copying src/aiortc/contrib/signaling.py -> build/lib.macosx-12.1-arm64-3.10/aiortc/contrib
copying src/aiortc/contrib/__init__.py -> build/lib.macosx-12.1-arm64-3.10/aiortc/contrib
running build_ext
generating cffi module 'build/temp.macosx-12.1-arm64-3.10/aiortc.codecs._vpx.c'
creating build/temp.macosx-12.1-arm64-3.10
generating cffi module 'build/temp.macosx-12.1-arm64-3.10/aiortc.codecs._opus.c'
building 'aiortc.codecs._opus' extension
creating build/temp.macosx-12.1-arm64-3.10/build
creating build/temp.macosx-12.1-arm64-3.10/build/temp.macosx-12.1-arm64-3.10
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Users/khiner/.pyenv/versions/3.10.1/include/python3.10 -c build/temp.macosx-12.1-arm64-3.10/aiortc.codecs._opus.c -o build/temp.macosx-12.1-arm64-3.10/build/temp.macosx-12.1-arm64-3.10/aiortc.codecs._opus.o
build/temp.macosx-12.1-arm64-3.10/aiortc.codecs._opus.c:570:10: fatal error: 'opus/opus.h' file not found
#include <opus/opus.h>
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for aiortc
Running setup.py clean for aiortc
Building wheel for av (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/khiner/.pyenv/versions/3.10.1/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/av_c104573c06eb499ab77d831695af77be/setup.py'"'"'; __file__='"'"'/private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/av_c104573c06eb499ab77d831695af77be/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-wheel-8x_qlg0w
cwd: /private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/av_c104573c06eb499ab77d831695af77be/
Complete output (48 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-12.1-arm64-3.10
creating build/lib.macosx-12.1-arm64-3.10/av
copying av/deprecation.py -> build/lib.macosx-12.1-arm64-3.10/av
copying av/datasets.py -> build/lib.macosx-12.1-arm64-3.10/av
copying av/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av
copying av/__main__.py -> build/lib.macosx-12.1-arm64-3.10/av
creating build/lib.macosx-12.1-arm64-3.10/av/video
copying av/video/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/video
creating build/lib.macosx-12.1-arm64-3.10/av/codec
copying av/codec/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/codec
creating build/lib.macosx-12.1-arm64-3.10/av/container
copying av/container/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/container
creating build/lib.macosx-12.1-arm64-3.10/av/audio
copying av/audio/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/audio
creating build/lib.macosx-12.1-arm64-3.10/av/subtitles
copying av/subtitles/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/subtitles
creating build/lib.macosx-12.1-arm64-3.10/av/filter
copying av/filter/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/filter
creating build/lib.macosx-12.1-arm64-3.10/av/sidedata
copying av/sidedata/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/sidedata
creating build/lib.macosx-12.1-arm64-3.10/av/data
copying av/data/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/data
running build_ext
running config
PyAV: 8.1.0 (unknown commit)
Python: 3.10.1 (main, Dec 31 2021, 12:49:09) [Clang 13.0.0 (clang-1300.0.29.30)]
platform: macOS-12.1-arm64-arm-64bit
extension_extra:
include_dirs: [b'include']
libraries: []
library_dirs: []
define_macros: []
runtime_library_dirs: []
config_macros:
PYAV_COMMIT_STR="unknown-commit"
PYAV_VERSION=8.1.0
PYAV_VERSION_STR="8.1.0"
Could not find libavformat with pkg-config.
Could not find libavcodec with pkg-config.
Could not find libavdevice with pkg-config.
Could not find libavutil with pkg-config.
Could not find libavfilter with pkg-config.
Could not find libswscale with pkg-config.
Could not find libswresample with pkg-config.
----------------------------------------
ERROR: Failed building wheel for av
Running setup.py clean for av
Failed to build aiortc av
Installing collected packages: av, aioice, aiortc
Running setup.py install for av ... error
ERROR: Command errored out with exit status 1:
command: /Users/khiner/.pyenv/versions/3.10.1/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/av_c104573c06eb499ab77d831695af77be/setup.py'"'"'; __file__='"'"'/private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/av_c104573c06eb499ab77d831695af77be/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-record-ixhf6blc/install-record.txt --single-version-externally-managed --compile --install-headers /Users/khiner/.pyenv/versions/3.10.1/include/python3.10/av
cwd: /private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/av_c104573c06eb499ab77d831695af77be/
Complete output (48 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-12.1-arm64-3.10
creating build/lib.macosx-12.1-arm64-3.10/av
copying av/deprecation.py -> build/lib.macosx-12.1-arm64-3.10/av
copying av/datasets.py -> build/lib.macosx-12.1-arm64-3.10/av
copying av/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av
copying av/__main__.py -> build/lib.macosx-12.1-arm64-3.10/av
creating build/lib.macosx-12.1-arm64-3.10/av/video
copying av/video/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/video
creating build/lib.macosx-12.1-arm64-3.10/av/codec
copying av/codec/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/codec
creating build/lib.macosx-12.1-arm64-3.10/av/container
copying av/container/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/container
creating build/lib.macosx-12.1-arm64-3.10/av/audio
copying av/audio/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/audio
creating build/lib.macosx-12.1-arm64-3.10/av/subtitles
copying av/subtitles/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/subtitles
creating build/lib.macosx-12.1-arm64-3.10/av/filter
copying av/filter/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/filter
creating build/lib.macosx-12.1-arm64-3.10/av/sidedata
copying av/sidedata/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/sidedata
creating build/lib.macosx-12.1-arm64-3.10/av/data
copying av/data/__init__.py -> build/lib.macosx-12.1-arm64-3.10/av/data
running build_ext
running config
PyAV: 8.1.0 (unknown commit)
Python: 3.10.1 (main, Dec 31 2021, 12:49:09) [Clang 13.0.0 (clang-1300.0.29.30)]
platform: macOS-12.1-arm64-arm-64bit
extension_extra:
include_dirs: [b'include']
libraries: []
library_dirs: []
define_macros: []
runtime_library_dirs: []
config_macros:
PYAV_COMMIT_STR="unknown-commit"
PYAV_VERSION=8.1.0
PYAV_VERSION_STR="8.1.0"
Could not find libavformat with pkg-config.
Could not find libavcodec with pkg-config.
Could not find libavdevice with pkg-config.
Could not find libavutil with pkg-config.
Could not find libavfilter with pkg-config.
Could not find libswscale with pkg-config.
Could not find libswresample with pkg-config.
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/khiner/.pyenv/versions/3.10.1/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/av_c104573c06eb499ab77d831695af77be/setup.py'"'"'; __file__='"'"'/private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-install-x8ehe9_c/av_c104573c06eb499ab77d831695af77be/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/wy/tjg12twn7ng380y1ml1z8hjm0000gn/T/pip-record-ixhf6blc/install-record.txt --single-version-externally-managed --compile --install-headers /Users/khiner/.pyenv/versions/3.10.1/include/python3.10/av Check the logs for full command output.
Seems like this is probably the root cause, since I should be able to just pip install
it?
Let's keep the issue narrowly focused on pylibsrtp
because the other packages for sure do not have binary wheels for arm64 yet. That means for pyav and aiortc you will need to check their README for the list of libraries you need to compile from source.
Can you in a fresh environment:
pip install pylibsrtp
Then run a python shell and try to import pylibsrtp
Gotcha. Ok I can reproduce the original issue with a totally fresh pyenv
install with python v3.10.1
:
$ pip install pylibsrtp
Collecting pylibsrtp
Using cached pylibsrtp-0.7.0-cp310-cp310-macosx_11_0_arm64.whl (11 kB)
Requirement already satisfied: cffi>=1.0.0 in ./.pyenv/versions/3.10.1/lib/python3.10/site-packages (from pylibsrtp) (1.15.0)
Requirement already satisfied: pycparser in ./.pyenv/versions/3.10.1/lib/python3.10/site-packages (from cffi>=1.0.0->pylibsrtp) (2.21)
Installing collected packages: pylibsrtp
Successfully installed pylibsrtp-0.7.0
$ python
Python 3.10.1 (main, Dec 31 2021, 13:48:52) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylibsrtp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/khiner/.pyenv/versions/3.10.1/lib/python3.10/site-packages/pylibsrtp/__init__.py", line 4, in <module>
from ._binding import ffi, lib
ImportError: dlopen(/Users/khiner/.pyenv/versions/3.10.1/lib/python3.10/site-packages/pylibsrtp/_binding.abi3.so, 0x0002): symbol not found in flat namespace '_srtp_add_stream'
I am facing the exact same issue, also using a M1 Mac.
M1 Pro is the same
Ouch. Could you try running:
file /Users/khiner/.pyenv/versions/3.10.1/lib/python3.10/site-packages/pylibsrtp/_binding.abi3.so
.. and report whether it gives you what architecture it was built for?
$ file venv/lib/python3.9/site-packages/pylibsrtp/_binding.abi3.so
venv/lib/python3.9/site-packages/pylibsrtp/_binding.abi3.so: Mach-O 64-bit bundle arm64
If it would have been x86 the Rosetta translation layer would have translated the binary, so that should not cause any issues
I'm really puzzled here, as expected this file is for arm64
, which is exactly what we want for an M1, isn't it?
It should be....I'm by no means an expert on Python etc, but feel free to shoot me stuff to try out!
Below is a different attempt at building the wheels, could you try installing the right wheel for your Python version and reporting back whether it fixes the problem?
Once you've installed the wheel in a clean environment the test is still to run a python shell and try to import pylibsrtp
pip install /Users/christian/Downloads/dist/pylibsrtp-0.7.0-cp39-cp39-macosx_11_0_arm64.whl --force-reinstall
seems to solve the issue. Image quality is abysmal, but this could be my setup :D
@crysxd thanks for the feedback. I'm currently building pylibsrtp 0.7.1, the wheels should reach PyPI in about 30mn.
Would you mind retrying with those wheels to check we can definitely close this issue?
REMINDER: this ticket is purely about pylibsrtp.
The pylibsrtp
0.7.1 wheels are available, could you give them a try?
Just linking my comment in aiortc
to here:
https://github.com/aiortc/aiortc/issues/579#issuecomment-1028219315
TL;DR this worked to fix my issue!
Cool, thank you for reporting back @jasonwc !
Sorry for the delay on my end.
Looks like this works for me too!
$ pip install pylibsrtp --force-reinstall
$ python
Python 3.10.1 (main, Dec 31 2021, 13:48:52) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylibsrtp
>>> # no errors!
Very cool, thanks for reporting back!
I'm unable to use
aiortc
after updating to a new M1 Mac (and Python 3.10) because of an error inpylibsrtp
:Any ideas here? Please let me know if any other details would be helpful.
Thanks!