towhee icon indicating copy to clipboard operation
towhee copied to clipboard

[Bug]: video-decode could not be successful in python 3.6 for failure to install av

Open binbinlv opened this issue 2 years ago • 8 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

>>> import towhee
>>>
>>>
>>> (
...     towhee.glob('/Users/binbin/Towhee_projects/archery.mp4')
...           .video_decode.ffmpeg()
...           .action_classification.actionclip(model_name='clip_vit_b16')
...           .show()
... )
Collecting av
  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
Building wheels for collected packages: av
  Building wheel for av (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/binbin/towhee-test-env-3.6-0.7.3/bin/python3 /Users/binbin/towhee-test-env-3.6-0.7.3/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/bs/z2281z812w13j5bmwc7jhhmm0000gn/T/tmpa5e41ttc
       cwd: /private/var/folders/bs/z2281z812w13j5bmwc7jhhmm0000gn/T/pip-install-s83cwphb/av_bf6b963e88d842d89b974bbf679ec5cb
  Complete output (122 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.6
  creating build/lib.macosx-10.9-x86_64-3.6/av
  copying av/deprecation.py -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/datasets.py -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/about.py -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/__main__.py -> build/lib.macosx-10.9-x86_64-3.6/av
  creating build/lib.macosx-10.9-x86_64-3.6/av/video
  copying av/video/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/av/video
  creating build/lib.macosx-10.9-x86_64-3.6/av/codec
  copying av/codec/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/av/codec
  creating build/lib.macosx-10.9-x86_64-3.6/av/container
  copying av/container/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/av/container
  creating build/lib.macosx-10.9-x86_64-3.6/av/audio
  copying av/audio/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/av/audio
  creating build/lib.macosx-10.9-x86_64-3.6/av/subtitles
  copying av/subtitles/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/av/subtitles
  creating build/lib.macosx-10.9-x86_64-3.6/av/filter
  copying av/filter/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/av/filter
  creating build/lib.macosx-10.9-x86_64-3.6/av/sidedata
  copying av/sidedata/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/av/sidedata
  creating build/lib.macosx-10.9-x86_64-3.6/av/data
  copying av/data/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/av/data
  copying av/utils.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/frame.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/descriptor.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/logging.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/format.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/__init__.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/error.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/buffer.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/packet.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/bytesource.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/enum.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/option.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/stream.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/dictionary.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/plane.pxd -> build/lib.macosx-10.9-x86_64-3.6/av
  copying av/video/frame.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/video
  copying av/video/reformatter.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/video
  copying av/video/format.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/video
  copying av/video/__init__.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/video
  copying av/video/codeccontext.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/video
  copying av/video/stream.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/video
  copying av/video/plane.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/video
  copying av/codec/__init__.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/codec
  copying av/codec/context.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/codec
  copying av/codec/codec.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/codec
  copying av/container/input.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/container
  copying av/container/core.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/container
  copying av/container/__init__.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/container
  copying av/container/pyio.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/container
  copying av/container/output.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/container
  copying av/container/streams.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/container
  copying av/audio/frame.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/audio
  copying av/audio/fifo.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/audio
  copying av/audio/format.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/audio
  copying av/audio/layout.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/audio
  copying av/audio/__init__.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/audio
  copying av/audio/codeccontext.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/audio
  copying av/audio/stream.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/audio
  copying av/audio/resampler.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/audio
  copying av/audio/plane.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/audio
  copying av/subtitles/__init__.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/subtitles
  copying av/subtitles/codeccontext.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/subtitles
  copying av/subtitles/stream.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/subtitles
  copying av/subtitles/subtitle.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/subtitles
  copying av/filter/__init__.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/filter
  copying av/filter/graph.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/filter
  copying av/filter/context.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/filter
  copying av/filter/filter.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/filter
  copying av/filter/pad.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/filter
  copying av/filter/link.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/filter
  copying av/sidedata/__init__.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/sidedata
  copying av/sidedata/motionvectors.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/sidedata
  copying av/sidedata/sidedata.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/sidedata
  copying av/data/__init__.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/data
  copying av/data/stream.pxd -> build/lib.macosx-10.9-x86_64-3.6/av/data
  running build_ext
  building 'av.plane' extension
  creating build/temp.macosx-10.9-x86_64-3.6
  creating build/temp.macosx-10.9-x86_64-3.6/src
  creating build/temp.macosx-10.9-x86_64-3.6/src/av
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -g -I/usr/local/Cellar/ffmpeg/5.0.1_3/include -I/Users/binbin/towhee-test-env-3.6-0.7.3/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/av/plane.c -o build/temp.macosx-10.9-x86_64-3.6/src/av/plane.o
  gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/src/av/plane.o -L/usr/local/Cellar/ffmpeg/5.0.1_3/lib -lavformat -lavcodec -lavdevice -lavutil -lavfilter -lswscale -lswresample -o build/lib.macosx-10.9-x86_64-3.6/av/plane.cpython-36m-darwin.so
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libavformat.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libavcodec.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libavdevice.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libavutil.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libswscale.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libavfilter.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libswresample.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  building 'av.dictionary' extension
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -g -I/usr/local/Cellar/ffmpeg/5.0.1_3/include -I/Users/binbin/towhee-test-env-3.6-0.7.3/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/av/dictionary.c -o build/temp.macosx-10.9-x86_64-3.6/src/av/dictionary.o
  gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/src/av/dictionary.o -L/usr/local/Cellar/ffmpeg/5.0.1_3/lib -lavformat -lavcodec -lavdevice -lavutil -lavfilter -lswscale -lswresample -o build/lib.macosx-10.9-x86_64-3.6/av/dictionary.cpython-36m-darwin.so
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libavformat.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libavcodec.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libavutil.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libavdevice.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libavfilter.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libswresample.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  ld: warning: dylib (/usr/local/Cellar/ffmpeg/5.0.1_3/lib/libswscale.dylib) was built for newer macOS version (11.0) than being linked (10.9)
  building 'av.stream' extension
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -g -I/usr/local/Cellar/ffmpeg/5.0.1_3/include -I/Users/binbin/towhee-test-env-3.6-0.7.3/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/av/stream.c -o build/temp.macosx-10.9-x86_64-3.6/src/av/stream.o
  src/av/stream.c:2305:29: error: no member named 'codec' in 'struct AVStream'
    switch (__pyx_v_c_stream->codec->codec_type) {
            ~~~~~~~~~~~~~~~~  ^
  src/av/stream.c:2923:31: error: no member named 'codec' in 'struct AVStream'
    __pyx_t_1 = __pyx_v_stream->codec;
                ~~~~~~~~~~~~~~  ^
  src/av/stream.c:3043: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:3828: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 'gcc' failed with exit status 1
  ----------------------------------------
  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

Expected Behavior

No error

Steps To Reproduce

Running the following code in python3.6 env:

import towhee

(
    towhee.glob('./archery.mp4') 
          .video_decode.ffmpeg()
          .action_classification.actionclip(model_name='clip_vit_b16')
          .show()
)

Environment

- Towhee version(e.g. v0.1.3 or 8b23a93): towhee 0.7.3 candidate
- OS(Ubuntu or CentOS):
- CPU/Memory:
- GPU:
- Others:

Anything else?

No response

binbinlv avatar Jul 22 '22 14:07 binbinlv

I believe this is the PyAv issue: https://github.com/PyAV-Org/PyAV/issues/817

filip-halt avatar Jul 22 '22 19:07 filip-halt

@filip-halt so this issue should be left as known issue until the fix of https://github.com/PyAV-Org/PyAV/issues/817?

@junjiejiangjjj

binbinlv avatar Jul 25 '22 11:07 binbinlv

@filip-halt so this issue should be left as known issue until the fix of PyAV-Org/PyAV#817?

@junjiejiangjjj

I believe so, but I think @junjiejiangjjj is the better person to ask.

filip-halt avatar Jul 25 '22 22:07 filip-halt

@junjiejiangjjj

So this issue should be left as known issue until the fix of https://github.com/PyAV-Org/PyAV/issues/817?

binbinlv avatar Jul 26 '22 02:07 binbinlv

Both video-decode.ffmpeg and audio-decode.ffmpeg use pyav. For it doesn't have a whl package for python3.6, if you want to use it in python3.6, you'd better install it by yourself (https://github.com/PyAV-Org/PyAV#installation)

junjiejiangjjj avatar Jul 26 '22 02:07 junjiejiangjjj

Set this issue as known issue for the issue of pyav.

binbinlv avatar Jul 27 '22 06:07 binbinlv

@junjiejiangjjj like this code

towhee.dc(['./1.mp4']) \
        .video_decode.ffmpeg(sample_type='uniform_temporal_subsample', args={'num_samples': 12}) \
        .runas_op(func=lambda x: [y for y in x]) \
        .video_text_embedding.clip4clip(model_name='clip_vit_b32', modality='video', device='cpu') \
        .show()

how can assign a video_text_embedding([0.31566384, -0.07464158, -0.023179442, ...] shape=(480,) ) to a variable

yfq512 avatar Aug 03 '22 08:08 yfq512

@junjiejiangjjj like this code

towhee.dc(['./1.mp4']) \
        .video_decode.ffmpeg(sample_type='uniform_temporal_subsample', args={'num_samples': 12}) \
        .runas_op(func=lambda x: [y for y in x]) \
        .video_text_embedding.clip4clip(model_name='clip_vit_b32', modality='video', device='cpu') \
        .show()

how can assign a video_text_embedding([0.31566384, -0.07464158, -0.023179442, ...] shape=(480,) ) to a variable

@reiase

junjiejiangjjj avatar Aug 03 '22 08:08 junjiejiangjjj

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Close the stale issues and pull requests after 7 days of inactivity. Reopen the issue with /reopen.

stale[bot] avatar Sep 02 '22 09:09 stale[bot]