Repository: PyAV-Org/PyAV

Issue #820: PyAv fails to install with pip in Python 3.10
Created: 2021-10-17T02:10:09Z
Pip fails to install PyAv in Python 3.10, although previously installing correctly in Python 3.9 . I'm running macOS, but I suspect this is a problem on Windows and Linux as well.
The command I ran was:
pip3 install av

pip3 being

  Building wheel output
Collecting av
  Using cached av-8.0.3.tar.gz (2.3 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: av
  Building wheel for av (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python@3.10/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-install-ueuk0jey/av_8390aa79b33c4620ba45138c42abf523/setup.py'"'"'; __file__='"'"'/private/var/folders/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-install-ueuk0jey/av_8390aa79b33c4620ba45138c42abf523/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/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-wheel-i6v5gwgz
       cwd: /private/var/folders/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-install-ueuk0jey/av_8390aa79b33c4620ba45138c42abf523/
  Complete output (70 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.15-x86_64-3.10
  creating build/lib.macosx-10.15-x86_64-3.10/av
  copying av/deprecation.py -> build/lib.macosx-10.15-x86_64-3.10/av
  copying av/datasets.py -> build/lib.macosx-10.15-x86_64-3.10/av
  copying av/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av
  copying av/__main__.py -> build/lib.macosx-10.15-x86_64-3.10/av
  creating build/lib.macosx-10.15-x86_64-3.10/av/video
  copying av/video/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/video
  creating build/lib.macosx-10.15-x86_64-3.10/av/codec
  copying av/codec/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/codec
  creating build/lib.macosx-10.15-x86_64-3.10/av/container
  copying av/container/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/container
  creating build/lib.macosx-10.15-x86_64-3.10/av/audio
  copying av/audio/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/audio
  creating build/lib.macosx-10.15-x86_64-3.10/av/subtitles
  copying av/subtitles/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/subtitles
  creating build/lib.macosx-10.15-x86_64-3.10/av/filter
  copying av/filter/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/filter
  creating build/lib.macosx-10.15-x86_64-3.10/av/sidedata
  copying av/sidedata/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/sidedata
  creating build/lib.macosx-10.15-x86_64-3.10/av/data
  copying av/data/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/data
  running build_ext
  running config
  PyAV: 8.0.3 (unknown commit)
  Python: 3.10.0 (default, Oct 13 2021, 06:44:31) [Clang 12.0.0 (clang-1200.0.32.29)]
  platform: macOS-10.15.7-x86_64-i386-64bit
  extension_extra:
  	include_dirs: [b'include', b'/usr/local/Cellar/ffmpeg/4.4_2/include']
  	libraries: [b'avformat', b'avcodec', b'avdevice', b'avutil', b'avfilter', b'swscale', b'swresample']
  	library_dirs: [b'/usr/local/Cellar/ffmpeg/4.4_2/lib']
  	define_macros: []
  	runtime_library_dirs: []
  config_macros:
  	PYAV_COMMIT_STR="unknown-commit"
  	PYAV_VERSION=8.0.3
  	PYAV_VERSION_STR="8.0.3"
  writing build/temp.macosx-10.15-x86_64-3.10/include/pyav/config.h
  running cythonize
  building 'av.plane' extension
  creating build/temp.macosx-10.15-x86_64-3.10/src
  creating build/temp.macosx-10.15-x86_64-3.10/src/av
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/usr/local/Cellar/ffmpeg/4.4_2/include -I/usr/local/include -Ibuild/temp.macosx-10.15-x86_64-3.10/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -Iinclude -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -Ibuild/temp.macosx-10.15-x86_64-3.10/include -c src/av/plane.c -o build/temp.macosx-10.15-x86_64-3.10/src/av/plane.o
  clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk build/temp.macosx-10.15-x86_64-3.10/src/av/plane.o -L/usr/local/opt/openssl@1.1/lib -L/usr/local/lib -L/usr/local/Cellar/ffmpeg/4.4_2/lib -L/usr/local/opt/sqlite/lib -L/usr/local/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/sqlite/lib -lavfilter -lavutil -lswresample -lavcodec -lswscale -lavdevice -lavformat -o build/lib.macosx-10.15-x86_64-3.10/av/plane.cpython-310-darwin.so
  building 'av.dictionary' extension
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/usr/local/Cellar/ffmpeg/4.4_2/include -I/usr/local/include -Ibuild/temp.macosx-10.15-x86_64-3.10/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -Iinclude -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -Ibuild/temp.macosx-10.15-x86_64-3.10/include -c src/av/dictionary.c -o build/temp.macosx-10.15-x86_64-3.10/src/av/dictionary.o
  src/av/dictionary.c:5948:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
              ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                    ^
  src/av/dictionary.c:5948:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
              ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/av/dictionary.c:5953:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
              ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                    ^
  src/av/dictionary.c:5953:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
              ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/av/dictionary.c:6037:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
              ret = _PyGen_Send((PyGenObject*)yf, NULL);
                    ^
  src/av/dictionary.c:6037:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
              ret = _PyGen_Send((PyGenObject*)yf, NULL);
                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3 warnings and 3 errors generated.
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for av



It then tries to build with setup.py, but also fails.

  Setup.py output
  Running setup.py clean for av
Failed to build av
Installing collected packages: av
    Running setup.py install for av ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/python@3.10/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-install-ueuk0jey/av_8390aa79b33c4620ba45138c42abf523/setup.py'"'"'; __file__='"'"'/private/var/folders/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-install-ueuk0jey/av_8390aa79b33c4620ba45138c42abf523/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/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-record-v2lev55f/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10/av
         cwd: /private/var/folders/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-install-ueuk0jey/av_8390aa79b33c4620ba45138c42abf523/
    Complete output (70 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.15-x86_64-3.10
    creating build/lib.macosx-10.15-x86_64-3.10/av
    copying av/deprecation.py -> build/lib.macosx-10.15-x86_64-3.10/av
    copying av/datasets.py -> build/lib.macosx-10.15-x86_64-3.10/av
    copying av/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av
    copying av/__main__.py -> build/lib.macosx-10.15-x86_64-3.10/av
    creating build/lib.macosx-10.15-x86_64-3.10/av/video
    copying av/video/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/video
    creating build/lib.macosx-10.15-x86_64-3.10/av/codec
    copying av/codec/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/codec
    creating build/lib.macosx-10.15-x86_64-3.10/av/container
    copying av/container/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/container
    creating build/lib.macosx-10.15-x86_64-3.10/av/audio
    copying av/audio/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/audio
    creating build/lib.macosx-10.15-x86_64-3.10/av/subtitles
    copying av/subtitles/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/subtitles
    creating build/lib.macosx-10.15-x86_64-3.10/av/filter
    copying av/filter/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/filter
    creating build/lib.macosx-10.15-x86_64-3.10/av/sidedata
    copying av/sidedata/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/sidedata
    creating build/lib.macosx-10.15-x86_64-3.10/av/data
    copying av/data/__init__.py -> build/lib.macosx-10.15-x86_64-3.10/av/data
    running build_ext
    running config
    PyAV: 8.0.3 (unknown commit)
    Python: 3.10.0 (default, Oct 13 2021, 06:44:31) [Clang 12.0.0 (clang-1200.0.32.29)]
    platform: macOS-10.15.7-x86_64-i386-64bit
    extension_extra:
    	include_dirs: [b'include', b'/usr/local/Cellar/ffmpeg/4.4_2/include']
    	libraries: [b'avformat', b'avcodec', b'avdevice', b'avutil', b'avfilter', b'swscale', b'swresample']
    	library_dirs: [b'/usr/local/Cellar/ffmpeg/4.4_2/lib']
    	define_macros: []
    	runtime_library_dirs: []
    config_macros:
    	PYAV_COMMIT_STR="unknown-commit"
    	PYAV_VERSION=8.0.3
    	PYAV_VERSION_STR="8.0.3"
    writing build/temp.macosx-10.15-x86_64-3.10/include/pyav/config.h
    running cythonize
    building 'av.plane' extension
    creating build/temp.macosx-10.15-x86_64-3.10/src
    creating build/temp.macosx-10.15-x86_64-3.10/src/av
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -I/usr/local/opt/openssl@1.1/include -Ibuild/temp.macosx-10.15-x86_64-3.10/include -I/usr/local/include -Iinclude -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/ffmpeg/4.4_2/include -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -Ibuild/temp.macosx-10.15-x86_64-3.10/include -c src/av/plane.c -o build/temp.macosx-10.15-x86_64-3.10/src/av/plane.o
    clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk build/temp.macosx-10.15-x86_64-3.10/src/av/plane.o -L/usr/local/opt/openssl@1.1/lib -L/usr/local/lib -L/usr/local/Cellar/ffmpeg/4.4_2/lib -L/usr/local/opt/sqlite/lib -L/usr/local/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/sqlite/lib -lavutil -lavcodec -lswresample -lswscale -lavdevice -lavfilter -lavformat -o build/lib.macosx-10.15-x86_64-3.10/av/plane.cpython-310-darwin.so
    building 'av.dictionary' extension
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -I/usr/local/opt/openssl@1.1/include -Ibuild/temp.macosx-10.15-x86_64-3.10/include -I/usr/local/include -Iinclude -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/ffmpeg/4.4_2/include -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -Ibuild/temp.macosx-10.15-x86_64-3.10/include -c src/av/dictionary.c -o build/temp.macosx-10.15-x86_64-3.10/src/av/dictionary.o
    src/av/dictionary.c:5948:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                      ^
    src/av/dictionary.c:5948:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
                ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/av/dictionary.c:5953:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                      ^
    src/av/dictionary.c:5953:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
                ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/av/dictionary.c:6037:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                ret = _PyGen_Send((PyGenObject*)yf, NULL);
                      ^
    src/av/dictionary.c:6037:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
                ret = _PyGen_Send((PyGenObject*)yf, NULL);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3 warnings and 3 errors generated.
    error: command '/usr/bin/clang' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.10/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-install-ueuk0jey/av_8390aa79b33c4620ba45138c42abf523/setup.py'"'"'; __file__='"'"'/private/var/folders/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-install-ueuk0jey/av_8390aa79b33c4620ba45138c42abf523/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/zq/hdpr7cks7tng18nrkd9v8qv80000gn/T/pip-record-v2lev55f/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10/av Check the logs for full command output.


Investigation
Python 3.10 wheels are not provided in PyPI, providing them should help.
Research
I have done the following:

 Checked the PyAV documentation
 Searched on Google
 Searched on Stack Overflow
 Looked through old GitHub issues
 Asked on PyAV Gitter
 ... and waited 72 hours for a response.

Duplicate issue #822: Cant import pyav in Python3.10
Created: 2021-10-19T08:26:58Z
IMPORTANT: Be sure to replace all template sections {{ like this }} or your issue may be discarded.
Overview
{{ i installed last version of PyAv and success, but cant import with python3.10 }}
Expected behavior
{{ maybe sime incompatible}}
Actual behavior
{{ A clear and concise description of what actually happened. }}
Build report:
{{ Complete output of `python setup.py build`. Reports that do not show compiler commands will not be accepted (e.g. results from `pip install av`). }}

Investigation
{{ What you did to isolate the problem. }}
Reproduction
{{ Steps to reproduce the behavior. }}
Versions

OS: {{ e.g. macOS 10.13.6 }}
PyAV runtime:

{{ Complete output of `python -m av --version` if you can run it. }}


PyAV build:

{{ Complete output of `python setup.py config --verbose`. }}


FFmpeg:

{{ Complete output of `ffmpeg -version` }}

Research
I have done the following:

 Checked the PyAV documentation
 Searched on Google
 Searched on Stack Overflow
 Looked through old GitHub issues
 Asked on PyAV Gitter
 ... and waited 72 hours for a response.

Additional context
{{ Add any other context about the problem here. }}

Closing comment (2021-11-03T23:32:20Z): Duplicate of #820