question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Impossible to install requirements on mac (FFMpeg)

See original GitHub issue

On mac M1

ffmpeg won’t compile: src/av/stream.c:2850:31: error: no member named 'codec' in 'struct AVStream'

If donwgrade ffmpeg to version 4: brew install ffmpeg@4

Installing collected packages: av, keras, rsa, cachetools, google-auth, Werkzeug, wheel, absl-py, tensorboard-data-server, grpcio, google-auth-oauthlib, protobuf, tensorboard-plugin-wit, tensorboard, astunparse, opt-einsum, typing-extensions, wrapt, tensorflow-io-gcs-filesystem, google-pasta, termcolor, libclang, flatbuffers, keras-preprocessing, gast, tf-estimator-nightly, tensorflow, patool, diskcache, threadpoolctl, scipy, joblib, scikit-learn, sklearn, ipython-genutils, nest-asyncio, argon2-cffi-bindings, argon2-cffi, traitlets, jupyter-core, entrypoints, pyzmq, tornado, jupyter-client, zipp, importlib-resources, pyrsistent, jsonschema, nbformat, Send2Trash, testpath, pandocfilters, nbclient, mistune, webencodings, bleach, jupyterlab-pygments, nbconvert, matplotlib-inline, ptyprocess, pexpect, asttokens, pure-eval, executing, stack-data, pickleshare, appnope, wcwidth, prompt-toolkit, backcall, decorator, parso, jedi, ipython, debugpy, ipykernel, prometheus-client, terminado, notebook, plyfile, kiwisolver, fonttools, cycler, matplotlib, widgetsnbextension, jupyterlab-widgets, ipywidgets, pandas, addict, tqdm, pyyaml, open3d, jmespath, botocore, s3transfer, boto3, azure-core, isodate, msrest, azure-storage-blob, google-crc32c, google-resumable-media, googleapis-common-protos, google-api-core, google-cloud-core, google-cloud-storage, lxml, networkx, tensorboardX, opencv-python, pycocotools, datumaro, natsort, mccabe, isort, toml, lazy-object-proxy, astroid, pylint, pylint-plugin-utils, pylint-django, rope, django-extensions, snakeviz
    Running setup.py install for av ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/ivkin/my/mycvat/.env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qt/nvw44cr91tj_k9snhhp834r40000gn/T/pip-install-bkhg5exd/av/setup.py'"'"'; __file__='"'"'/private/var/folders/qt/nvw44cr91tj_k9snhhp834r40000gn/T/pip-install-bkhg5exd/av/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qt/nvw44cr91tj_k9snhhp834r40000gn/T/pip-record-5k5t1kzt/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ivkin/my/mycvat/.env/include/site/python3.8/av
         cwd: /private/var/folders/qt/nvw44cr91tj_k9snhhp834r40000gn/T/pip-install-bkhg5exd/av/
    Complete output (48 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    creating build/lib.macosx-10.9-x86_64-3.8/av
    copying av/deprecation.py -> build/lib.macosx-10.9-x86_64-3.8/av
    copying av/datasets.py -> build/lib.macosx-10.9-x86_64-3.8/av
    copying av/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/av
    copying av/__main__.py -> build/lib.macosx-10.9-x86_64-3.8/av
    creating build/lib.macosx-10.9-x86_64-3.8/av/video
    copying av/video/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/av/video
    creating build/lib.macosx-10.9-x86_64-3.8/av/codec
    copying av/codec/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/av/codec
    creating build/lib.macosx-10.9-x86_64-3.8/av/container
    copying av/container/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/av/container
    creating build/lib.macosx-10.9-x86_64-3.8/av/audio
    copying av/audio/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/av/audio
    creating build/lib.macosx-10.9-x86_64-3.8/av/subtitles
    copying av/subtitles/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/av/subtitles
    creating build/lib.macosx-10.9-x86_64-3.8/av/filter
    copying av/filter/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/av/filter
    creating build/lib.macosx-10.9-x86_64-3.8/av/sidedata
    copying av/sidedata/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/av/sidedata
    creating build/lib.macosx-10.9-x86_64-3.8/av/data
    copying av/data/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/av/data
    running build_ext
    running config
    PyAV: 8.0.2 (unknown commit)
    Python: 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27) \n[Clang 6.0 (clang-600.0.57)]
    platform: macOS-10.16-x86_64-i386-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.0.2
    	PYAV_VERSION_STR="8.0.2"
    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/ivkin/my/mycvat/.env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qt/nvw44cr91tj_k9snhhp834r40000gn/T/pip-install-bkhg5exd/av/setup.py'"'"'; __file__='"'"'/private/var/folders/qt/nvw44cr91tj_k9snhhp834r40000gn/T/pip-install-bkhg5exd/av/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qt/nvw44cr91tj_k9snhhp834r40000gn/T/pip-record-5k5t1kzt/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ivkin/my/mycvat/.env/include/site/python3.8/av Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 22.0.3 is available.

None of options work:

  1. Default python 3.8.5
  2. Homebrew python 3.9.10
  3. Running build in Rosetta terminal

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
evekeencommented, Mar 3, 2022

I’ve tried another mac - Intel. The same problem. I had to change dependency versions in order to make it work. One of the problem is that new FFMpeg install from Homebrew does not work. I had to downgrade it to the latest 4.X version:

cd "$(brew --repo homebrew/core)"
git checkout addd616edc9134f057e33694c420f4900be59db8
brew unlink ffmpeg
HOMEBREW_NO_AUTO_UPDATE=1 brew install ffmpeg

Also I had to change in requirements/base.txt:

opencv-python-headless==4.4.0.46
h5py==3.6.0
open3d==0.14.1

I’ll create a PR

0reactions
ryushkoucommented, Jun 28, 2022

I have applied all suggested fixes here and in #4414 but still have the same issue:

MacBook Pro (Intel x64) macOS Monterey (Version 12.4) (pyenv) Python 3.9.10

Installing collected packages: wrapt, tf-estimator-nightly, termcolor, tensorboard-plugin-wit, Shapely, rules, rope, rjsmin, rcssmin, pytz, pyasn1, patool, mistune, mccabe, libclang, keras, itypes, flatbuffers, entrypoint2, EasyProcess, dj-pagination, diskcache, av, addict, Werkzeug, urllib3, uritemplate, typing-extensions, tqdm, tornado, toml, threadpoolctl, tensorflow-io-gcs-filesystem, tensorboard-data-server, sqlparse, smmap, six, ruamel.yaml.clib, rsa, redis, PyYAML, pyunpack, pyrsistent, pyparsing, pylogbeat, pyjwt, Pygments, pycparser, pyasn1-modules, protobuf, Pillow, oauthlib, numpy, networkx, natsort, MarkupSafe, Markdown, lxml, lazy-object-proxy, kiwisolver, joblib, jmespath, isort, inflection, idna, google-crc32c, gast, fonttools, dnspython, django-extensions, deprecated, defusedxml, cycler, click, charset-normalizer, certifi, cachetools, attrs, asgiref, absl-py, tensorboardX, snakeviz, scipy, ruamel.yaml, rq, requests, python3-openid, python-ldap, python-dateutil, pdf2image, packaging, orderedmultidict, opt-einsum, opencv-python-headless, opencv-python, keras-preprocessing, jsonschema, jinja2, isodate, h5py, grpcio, googleapis-common-protos, google-resumable-media, google-pasta, google-auth, gitdb, Django, cffi, astunparse, astroid, scikit-learn, requests-oauthlib, pylint, pandas, matplotlib, limits, google-api-core, GitPython, furl, djangorestframework, django-sendfile2, django-rq, django-filter, django-cors-headers, django-auth-ldap, django-appconf, cryptography, croniter, coreschema, botocore, azure-core, s3transfer, rq-scheduler, python-logstash-async, pylint-plugin-utils, pycocotools, open3d, msrest, google-cloud-core, google-auth-oauthlib, drf-spectacular, django-rest-auth, django-compressor, coreapi, tensorboard, pylint-django, google-cloud-storage, django-allauth, datumaro, boto3, azure-storage-blob, tensorflow
  Running setup.py install for av ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for av did not run successfully.
  │ exit code: 1
  ╰─> [50 lines of output]
      running install
      /Users/dd/cvat/.env/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.macosx-12.4-x86_64-cpython-39
      creating build/lib.macosx-12.4-x86_64-cpython-39/av
      copying av/deprecation.py -> build/lib.macosx-12.4-x86_64-cpython-39/av
      copying av/datasets.py -> build/lib.macosx-12.4-x86_64-cpython-39/av
      copying av/__init__.py -> build/lib.macosx-12.4-x86_64-cpython-39/av
      copying av/__main__.py -> build/lib.macosx-12.4-x86_64-cpython-39/av
      creating build/lib.macosx-12.4-x86_64-cpython-39/av/video
      copying av/video/__init__.py -> build/lib.macosx-12.4-x86_64-cpython-39/av/video
      creating build/lib.macosx-12.4-x86_64-cpython-39/av/codec
      copying av/codec/__init__.py -> build/lib.macosx-12.4-x86_64-cpython-39/av/codec
      creating build/lib.macosx-12.4-x86_64-cpython-39/av/container
      copying av/container/__init__.py -> build/lib.macosx-12.4-x86_64-cpython-39/av/container
      creating build/lib.macosx-12.4-x86_64-cpython-39/av/audio
      copying av/audio/__init__.py -> build/lib.macosx-12.4-x86_64-cpython-39/av/audio
      creating build/lib.macosx-12.4-x86_64-cpython-39/av/subtitles
      copying av/subtitles/__init__.py -> build/lib.macosx-12.4-x86_64-cpython-39/av/subtitles
      creating build/lib.macosx-12.4-x86_64-cpython-39/av/filter
      copying av/filter/__init__.py -> build/lib.macosx-12.4-x86_64-cpython-39/av/filter
      creating build/lib.macosx-12.4-x86_64-cpython-39/av/sidedata
      copying av/sidedata/__init__.py -> build/lib.macosx-12.4-x86_64-cpython-39/av/sidedata
      creating build/lib.macosx-12.4-x86_64-cpython-39/av/data
      copying av/data/__init__.py -> build/lib.macosx-12.4-x86_64-cpython-39/av/data
      running build_ext
      running config
      PyAV: 8.0.2 (unknown commit)
      Python: 3.9.10 (main, Jun 28 2022, 17:49:16) \n[Clang 13.1.6 (clang-1316.0.21.2.5)]
      platform: macOS-12.4-x86_64-i386-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.0.2
          PYAV_VERSION_STR="8.0.2"
      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.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> av

Could you suggest me options to unlock development version installation for Mac?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Impossible to install requirements on mac (FFMpeg) #4406
I've tried another mac - Intel. The same problem. I had to change dependency versions in order to make it work. One of...
Read more >
Can't install ffmpeg on macOS High Sierra 10.13.6 - Super User
Download ffmpeg for macOS from evermeet.cx. Put it in /usr/local/bin and you can execute it from any directory.
Read more >
Installing FFmpeg on macOS Catalina (Updated Late 2020)
Video Notes: https://www.rickmakes.com/ installing - ffmpeg -on- macos -catalina-updated-late-2020/ FFmpeg download: https:// ffmpeg.
Read more >
Installing ffmpeg and ffprobe on macOS manually
Installing ffmpeg and ffprobe on macOS manually · Go to https://ffmpeg.org/download.html and click the Apple logo in the "Get packages & executable files" ......
Read more >
ffmpeg installation on macOS for MoviePy fails with SSL error
I was able to find a workaround for macOS by debugging the fetching script: manually download the built (this is where the SSL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found