leng-yue / py-scrcpy-client

An easy to use python scrcpy client
https://leng-yue.github.io/py-scrcpy-client/
MIT License
283 stars 71 forks source link

Problem with `av` library on macos 13.3.1 #46

Closed Howardzi-nn closed 1 year ago

Howardzi-nn commented 1 year ago

Hello, im using Mac (M2, 13.3.1) and im getting this error when im trying to compile the library (with help of pip)

pip3 install scrcpy-client  
Collecting scrcpy-client
  Using cached scrcpy_client-0.4.1-py3-none-any.whl (55 kB)
Collecting adbutils<0.15.0,>=0.14.1
  Using cached adbutils-0.14.1-py3-none-any.whl
Collecting av<10.0.0,>=9.2.0
  Using cached av-9.2.0.tar.gz (2.4 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting opencv-python<5.0.0,>=4.5.3
  Using cached opencv_python-4.7.0.72-cp37-abi3-macosx_11_0_arm64.whl (32.6 MB)
Collecting whichcraft
  Using cached whichcraft-0.6.1-py2.py3-none-any.whl (5.2 kB)
Collecting requests
  Using cached requests-2.28.2-py3-none-any.whl (62 kB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting deprecation<3.0,>=2.0.6
  Using cached deprecation-2.1.0-py2.py3-none-any.whl (11 kB)
Collecting retry>=0.9
  Using cached retry-0.9.2-py2.py3-none-any.whl (8.0 kB)
Collecting apkutils2<2.0,>=1.0.0
  Using cached apkutils2-1.0.0-py3-none-any.whl
Collecting numpy>=1.21.2
  Using cached numpy-1.24.3-cp311-cp311-macosx_11_0_arm64.whl (13.8 MB)
Collecting pyelftools
  Using cached pyelftools-0.29-py2.py3-none-any.whl (174 kB)
Collecting cigam
  Using cached cigam-0.0.3-py3-none-any.whl (3.8 kB)
Collecting xmltodict
  Using cached xmltodict-0.13.0-py2.py3-none-any.whl (10.0 kB)
Collecting packaging
  Using cached packaging-23.1-py3-none-any.whl (48 kB)
Collecting decorator>=3.4.2
  Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB)
Collecting py<2.0.0,>=1.4.26
  Using cached py-1.11.0-py2.py3-none-any.whl (98 kB)
Collecting charset-normalizer<4,>=2
  Using cached charset_normalizer-3.1.0-cp311-cp311-macosx_11_0_arm64.whl (121 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.15-py2.py3-none-any.whl (140 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Building wheels for collected packages: av
  Building wheel for av (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for av (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [136 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-311
      creating build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/deprecation.py -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/datasets.py -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/about.py -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/__main__.py -> build/lib.macosx-10.9-universal2-cpython-311/av
      creating build/lib.macosx-10.9-universal2-cpython-311/av/video
      copying av/video/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/av/video
      creating build/lib.macosx-10.9-universal2-cpython-311/av/codec
      copying av/codec/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/av/codec
      creating build/lib.macosx-10.9-universal2-cpython-311/av/container
      copying av/container/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/av/container
      creating build/lib.macosx-10.9-universal2-cpython-311/av/audio
      copying av/audio/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/av/audio
      creating build/lib.macosx-10.9-universal2-cpython-311/av/subtitles
      copying av/subtitles/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/av/subtitles
      creating build/lib.macosx-10.9-universal2-cpython-311/av/filter
      copying av/filter/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/av/filter
      creating build/lib.macosx-10.9-universal2-cpython-311/av/sidedata
      copying av/sidedata/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/av/sidedata
      creating build/lib.macosx-10.9-universal2-cpython-311/av/data
      copying av/data/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/av/data
      copying av/utils.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/frame.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/descriptor.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/logging.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/format.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/__init__.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/error.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/buffer.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/packet.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/bytesource.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/enum.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/option.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/stream.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/dictionary.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/plane.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av
      copying av/video/frame.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/video
      copying av/video/reformatter.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/video
      copying av/video/format.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/video
      copying av/video/__init__.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/video
      copying av/video/codeccontext.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/video
      copying av/video/stream.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/video
      copying av/video/plane.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/video
      copying av/codec/__init__.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/codec
      copying av/codec/context.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/codec
      copying av/codec/codec.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/codec
      copying av/container/input.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/container
      copying av/container/core.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/container
      copying av/container/__init__.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/container
      copying av/container/pyio.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/container
      copying av/container/output.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/container
      copying av/container/streams.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/container
      copying av/audio/frame.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/audio
      copying av/audio/fifo.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/audio
      copying av/audio/format.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/audio
      copying av/audio/layout.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/audio
      copying av/audio/__init__.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/audio
      copying av/audio/codeccontext.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/audio
      copying av/audio/stream.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/audio
      copying av/audio/resampler.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/audio
      copying av/audio/plane.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/audio
      copying av/subtitles/__init__.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/subtitles
      copying av/subtitles/codeccontext.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/subtitles
      copying av/subtitles/stream.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/subtitles
      copying av/subtitles/subtitle.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/subtitles
      copying av/filter/__init__.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/filter
      copying av/filter/graph.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/filter
      copying av/filter/context.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/filter
      copying av/filter/filter.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/filter
      copying av/filter/pad.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/filter
      copying av/filter/link.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/filter
      copying av/sidedata/__init__.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/sidedata
      copying av/sidedata/motionvectors.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/sidedata
      copying av/sidedata/sidedata.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/sidedata
      copying av/data/__init__.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/data
      copying av/data/stream.pxd -> build/lib.macosx-10.9-universal2-cpython-311/av/data
      running build_ext
      building 'av.plane' extension
      creating build/temp.macosx-10.9-universal2-cpython-311
      creating build/temp.macosx-10.9-universal2-cpython-311/src
      creating build/temp.macosx-10.9-universal2-cpython-311/src/av
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/opt/homebrew/Cellar/ffmpeg/6.0/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c src/av/plane.c -o build/temp.macosx-10.9-universal2-cpython-311/src/av/plane.o
      clang -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64 -g build/temp.macosx-10.9-universal2-cpython-311/src/av/plane.o -L/opt/homebrew/Cellar/ffmpeg/6.0/lib -lavformat -lavcodec -lavdevice -lavutil -lavfilter -lswscale -lswresample -o build/lib.macosx-10.9-universal2-cpython-311/av/plane.cpython-311-darwin.so
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libavformat.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libavutil.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libavcodec.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libswresample.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libswscale.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libavdevice.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libavfilter.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libavfilter.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libavcodec.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libswscale.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libswresample.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libavutil.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libavdevice.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libavformat.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      building 'av.dictionary' extension
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/opt/homebrew/Cellar/ffmpeg/6.0/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c src/av/dictionary.c -o build/temp.macosx-10.9-universal2-cpython-311/src/av/dictionary.o
      clang -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64 -g build/temp.macosx-10.9-universal2-cpython-311/src/av/dictionary.o -L/opt/homebrew/Cellar/ffmpeg/6.0/lib -lavformat -lavcodec -lavdevice -lavutil -lavfilter -lswscale -lswresample -o build/lib.macosx-10.9-universal2-cpython-311/av/dictionary.cpython-311-darwin.so
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libavdevice.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libavcodec.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libavformat.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libavfilter.dylib) was built for newer macOS version (13.0) than being linked (11.0)dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libavutil.dylib) was built for newer macOS version (13.0) than being linked (11.0)

      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libswresample.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: dylib (/opt/homebrew/Cellar/ffmpeg/6.0/lib/libswscale.dylib) was built for newer macOS version (13.0) than being linked (11.0)
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libavcodec.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libavutil.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libavfilter.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libavformat.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libswresample.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libavdevice.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      ld: warning: ignoring file /opt/homebrew/Cellar/ffmpeg/6.0/lib/libswscale.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
      building 'av.stream' extension
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/opt/homebrew/Cellar/ffmpeg/6.0/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c src/av/stream.c -o build/temp.macosx-10.9-universal2-cpython-311/src/av/stream.o
      src/av/stream.c:2361:29: error: no member named 'codec' in 'struct AVStream'
        switch (__pyx_v_c_stream->codec->codec_type) {
                ~~~~~~~~~~~~~~~~  ^
      src/av/stream.c:2979:31: error: no member named 'codec' in 'struct AVStream'
        __pyx_t_1 = __pyx_v_stream->codec;
                    ~~~~~~~~~~~~~~  ^
      src/av/stream.c:3099:15: warning: assigning to 'struct AVCodec *' from 'const struct AVCodec *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
          __pyx_t_6 = __pyx_v_self->_codec_context->codec;
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/av/stream.c:3884:132: error: no member named 'codec' in 'struct AVStream'
        __pyx_t_7 = __pyx_f_2av_5error_err_check(avcodec_parameters_from_context(__pyx_v_self->_stream->codecpar, __pyx_v_self->_stream->codec), 0, NULL); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 150, __pyx_L1_error)
                                                                                                                  ~~~~~~~~~~~~~~~~~~~~~  ^
      1 warning and 3 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for av
Failed to build av
ERROR: Could not build wheels for av, which is required to install pyproject.toml-based projects

may update the av to version 10 will help, but honestly im not sure what im doing wrong.

Thank you for any advice (-: M.

Howardzi-nn commented 1 year ago

Solved, just can't read requests (bad python version) M.