Can't install FFMPEG using pip

Question:

I tried to install ffmpeg using pip like this

pip install ffmpeg

However I got the following error:

Collecting ffmpeg
  Using cached ffmpeg-1.4.tar.gz (5.1 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:Usersvwu20AppDataLocalTemppip-install-rdqrdeeqffmpeg_3cdda176f3f04ceea4a14d868e94924esetup.py", line 13, in <module>
          setup(
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libsite-packagessetuptools__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libsite-packagessetuptools_distutilscore.py", line 147, in setup
          _setup_distribution = dist = klass(attrs)
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libsite-packagessetuptoolsdist.py", line 476, in __init__
          _Distribution.__init__(
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libsite-packagessetuptools_distutilsdist.py", line 282, in __init__
          self.finalize_options()
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libsite-packagessetuptoolsdist.py", line 899, in finalize_options
          for ep in sorted(loaded, key=by_order):
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libsite-packagessetuptoolsdist.py", line 898, in <lambda>
          loaded = map(lambda e: e.load(), filtered)
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libimportlibmetadata__init__.py", line 171, in load
          module = import_module(match.group('module'))
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libimportlib__init__.py", line 126, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 883, in exec_module
        File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libsite-packagespy2appbuild_app.py", line 37, in <module>
          from py2app.create_appbundle import create_appbundle
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libsite-packagespy2appcreate_appbundle.py", line 9, in <module>
          from py2app.util import make_exec, makedirs, mergecopy, mergetree, skipscm
        File "C:Usersvwu20AppDataLocalProgramsPythonPython310libsite-packagespy2apputil.py", line 5, in <module>
          import fcntl
      ModuleNotFoundError: No module named 'fcntl'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

The error message says that it’s missing a package called fcntl, so i tried to install it using

pip install fcntl

The attempt to install fcntl produce the following error:

ERROR: Could not find a version that satisfies the requirement fcntl (from versions: none)
ERROR: No matching distribution found for fcntl

Can anyone tell me what I did wrong? I am using windows 11, python 3.10, pip 23.1.2
Help would be appreciated.

Asked By: turrnut

||

Answers:

That’s not the package you want. That one is Linux only and is unprofessional. Instead, try:

pip install ffmpeg-python

Note, however, that you will need to install ffmpeg (the command line, not the Python module) before you do that. There are instructions on the git page.

https://github.com/kkroening/ffmpeg-python

In case it’s not clear, ffmpeg is a very large, complicated, and capable command-line toolkit. The Python modules don’t actually do any video work — they all just build complicated ffmpeg command lines and then run them.

Answered By: Tim Roberts
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.