Skip to content

Cannot install curl_cffi despite being pure Python #987

@Malte000

Description

@Malte000

As the latest versions of yt-dlp require curl_cffi to deal with TLS fingerprinting on certain sites (e.g. Dailymotion), I have tried to install curl_cffi via pip: pip install curl_cffi, but have encountered an error:

error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [52 lines of output]
      Traceback (most recent call last):
        File "/var/mobile/Containers/Data/Application/09283564-04CD-43DC-B078-734F48BAAA8A/Library/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
          ~~~~^^
        File "/var/mobile/Containers/Data/Application/09283564-04CD-43DC-B078-734F48BAAA8A/Library/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "/var/mobile/Containers/Data/Application/09283564-04CD-43DC-B078-734F48BAAA8A/Library/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 175, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/setuptools/build_meta.py", line 374, in prepare_metadata_for_build_wheel
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 16, in <module>
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/setuptools/__init__.py", line 115, in setup
          return distutils.core.setup(**attrs)
                 ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/setuptools/_distutils/core.py", line 148, in setup
          _setup_distribution = dist = klass(attrs)
                                       ~~~~~^^^^^^^
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/setuptools/dist.py", line 321, in __init__
          _Distribution.__init__(self, dist_attrs)
          ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/setuptools/_distutils/dist.py", line 309, in __init__
          self.finalize_options()
          ~~~~~~~~~~~~~~~~~~~~~^^
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/setuptools/dist.py", line 784, in finalize_options
          ep(self)
          ~~^^^^^^
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/setuptools/dist.py", line 804, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
          ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/cffi/setuptools_ext.py", line 216, in cffi_modules
          add_cffi_module(dist, cffi_module)
          ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
          execfile(build_file_name, mod_vars)
          ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/site-packages/cffi/setuptools_ext.py", line 25, in execfile
          exec(code, glob, glob)
          ~~~~^^^^^^^^^^^^^^^^^^
        File "scripts/build.py", line 51, in <module>
          arch = detect_arch()
        File "scripts/build.py", line 24, in detect_arch
          libc, _ = platform.libc_ver()
                    ~~~~~~~~~~~~~~~~~^^
        File "/private/var/containers/Bundle/Application/5553F620-F226-4B65-9A39-8D1231C80D3A/a-Shell.app/Library/lib/python3.13/platform.py", line 204, in libc_ver
          with open(executable, 'rb') as f:
               ~~~~^^^^^^^^^^^^^^^^^^
      FileNotFoundError: [Errno 2] No such file or directory: '/private/var/mobile/Containers/Data/Application/09283564-04CD-43DC-B078-734F48BAAA8A/tmp/pip-install-s4dgwh8r/curl-cffi_92e911ab11854cb0999385284b441ecc/python3'
      [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.
╰─> curl_cffi

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

Furthermore, curl_cffi seems to require curl-impersonate, of which there appear to be actual prebuilt iOS binaries: https://github.com/lexiforest/curl-impersonate/releases. Would it somehow be possible to make it all work on a-shell?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions