aarnphm / whispercpp

Pybind11 bindings for Whisper.cpp
Apache License 2.0
324 stars 63 forks source link

bug: pip install fail #54

Closed sudochia closed 1 year ago

sudochia commented 1 year ago

Describe the bug

Got this error when running pip install whispercpp

Collecting whispercpp
  Using cached whispercpp-0.0.12.tar.gz (684 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: whispercpp
  Building wheel for whispercpp (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/sudochia/anaconda3/envs/py39/bin/python /Users/sudochia/anaconda3/envs/py39/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/tmpoqby07_u
       cwd: /private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-install-46wgz2zd/whispercpp_d0cf4eb3d1ae4e1694bd86e4bcf9c89f
  Complete output (104 lines):
  /private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-build-env-udds7pkd/overlay/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py:108: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
    warnings.warn(msg, _BetaConfiguration)
  running bdist_wheel
  INFO: Running bazel wrapper (see //tools/bazel for details), bazel version 6.0.0 will be used instead of system-wide bazel installation.
  Downloading bazel, will try URLs: https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-darwin-x86_64 https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-darwin-x86_64
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed

    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    0   257    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  curl: (22) The requested URL returned error: 404
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed

    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

    1 48.1M    1  767k    0     0   813k      0  0:01:00 --:--:--  0:01:00  813k
   29 48.1M   29 14.2M    0     0  7329k      0  0:00:06  0:00:01  0:00:05 12.8M
   61 48.1M   61 29.7M    0     0  9430k      0  0:00:05  0:00:03  0:00:02 12.6M
   74 48.1M   74 35.9M    0     0  9587k      0  0:00:05  0:00:03  0:00:02 12.1M
   96 48.1M   96 46.2M    0     0  9788k      0  0:00:05  0:00:04  0:00:01 11.6M
  100 48.1M  100 48.1M    0     0   9.7M      0  0:00:04  0:00:04 --:--:-- 11.9M
  Starting local Bazel server and connecting to it...
  Loading:
  Loading: 0 packages loaded
  Analyzing: target //:extensions (1 packages loaded, 0 targets configured)
  Analyzing: target //:extensions (41 packages loaded, 19 targets configured)
  Analyzing: target //:extensions (49 packages loaded, 465 targets configured)
  Analyzing: target //:extensions (49 packages loaded, 465 targets configured)
  Analyzing: target //:extensions (49 packages loaded, 465 targets configured)
  Analyzing: target //:extensions (50 packages loaded, 495 targets configured)
  Analyzing: target //:extensions (50 packages loaded, 495 targets configured)
  Analyzing: target //:extensions (51 packages loaded, 573 targets configured)
  Analyzing: target //:extensions (51 packages loaded, 573 targets configured)
  Analyzing: target //:extensions (54 packages loaded, 2035 targets configured)
  Analyzing: target //:extensions (54 packages loaded, 2035 targets configured)
  Analyzing: target //:extensions (54 packages loaded, 2035 targets configured)
  Analyzing: target //:extensions (56 packages loaded, 2089 targets configured)
  Analyzing: target //:extensions (58 packages loaded, 2185 targets configured)
  Analyzing: target //:extensions (58 packages loaded, 2185 targets configured)
  INFO: Analyzed target //:extensions (60 packages loaded, 11089 targets configured).
  INFO: Found 1 target...
  [0 / 8] [Prepa] Writing file extensions.sh
  [5 / 8] checking cached actions
  [23 / 121] Compiling ggml.c; 0s darwin-sandbox ... (4 actions running)
  [23 / 121] Compiling ggml.c; 1s darwin-sandbox ... (5 actions running)
  [23 / 121] Compiling ggml.c; 3s darwin-sandbox ... (6 actions, 5 running)
  [25 / 121] Compiling ggml.c; 4s darwin-sandbox ... (5 actions running)
  [25 / 121] Compiling ggml.c; 7s darwin-sandbox ... (6 actions, 5 running)
  INFO: From Compiling ggml.c:
  external/com_github_ggerganov_whisper/ggml.c:1465:19: warning: unused function 'ggml_up64' [-Wunused-function]
  static inline int ggml_up64(int n) {
                    ^
  1 warning generated.
  [27 / 121] Compiling whisper.cpp; 9s darwin-sandbox ... (5 actions running)
  [111 / 123] Compiling whisper.cpp; 10s darwin-sandbox ... (5 actions, 4 running)
  [115 / 127] Compiling whisper.cpp; 11s darwin-sandbox ... (4 actions running)
  [116 / 127] Compiling whisper.cpp; 14s darwin-sandbox ... (4 actions, 3 running)
  [118 / 127] Compiling src/whispercpp/api_cpp2py_export.cc; 15s darwin-sandbox ... (3 actions, 2 running)
  ERROR: /private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-install-46wgz2zd/whispercpp_d0cf4eb3d1ae4e1694bd86e4bcf9c89f/BUILD.bazel:127:17: Linking api_cpp2py_export.so failed: (Exit 1): cc_wrapper.sh failed: error executing command (from target //:api_cpp2py_export.so) external/llvm_toolchain/bin/cc_wrapper.sh @bazel-out/darwin-fastbuild/bin/api_cpp2py_export.so-2.params

  Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
  clang: error: invalid linker name in argument '-fuse-ld=lld'
  Target //:extensions failed to build
  Use --verbose_failures to see the command lines of failed build steps.
  INFO: Elapsed time: 132.521s, Critical Path: 17.18s
  INFO: 122 processes: 112 internal, 9 darwin-sandbox, 1 local.
  FAILED: Build did NOT complete successfully
  ERROR: Build failed. Not running target
  Building pybind11 extension...
  Traceback (most recent call last):
    File "/Users/sudochia/anaconda3/envs/py39/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in <module>
      main()
    File "/Users/sudochia/anaconda3/envs/py39/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/sudochia/anaconda3/envs/py39/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 248, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-build-env-udds7pkd/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 413, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-build-env-udds7pkd/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 398, in _build_with_temp_dir
      self.run_setup()
    File "/private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-build-env-udds7pkd/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 335, in run_setup
      exec(code, locals())
    File "<string>", line 39, in <module>
    File "/private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-build-env-udds7pkd/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 108, in setup
      return distutils.core.setup(**attrs)
    File "/private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-build-env-udds7pkd/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
    File "/private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-build-env-udds7pkd/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-build-env-udds7pkd/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-build-env-udds7pkd/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1221, in run_command
      super().run_command(command)
    File "/private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-build-env-udds7pkd/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "<string>", line 27, in run
    File "<string>", line 22, in compile_ext
    File "/Users/sudochia/anaconda3/envs/py39/lib/python3.9/subprocess.py", line 424, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "/Users/sudochia/anaconda3/envs/py39/lib/python3.9/subprocess.py", line 528, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['/private/var/folders/sq/stfprb0j06d3gjdr3ghknsyc0000gn/T/pip-install-46wgz2zd/whispercpp_d0cf4eb3d1ae4e1694bd86e4bcf9c89f/tools/bazel', 'run', '//:extensions']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for whispercpp
Failed to build whispercpp
ERROR: Could not build wheels for whispercpp which use PEP 517 and cannot be installed directly

To reproduce

Just run pip install whispercpp on a Macbook Pro with Intel chip

Expected behavior

No response

Environment

Python 3.9.12 MacBook Pro 2.9 GHz Quad-Core Intel Core i7

aarnphm commented 1 year ago

Do you have lld locally? I will release a new version soon where we don't depend on llvm anymore.

sudochia commented 1 year ago

i think lld doesn't work on macOS.

aarnphm commented 1 year ago

Please try again. I'm releasing 0.0.14 that include supports for m1 wheels.

sudochia commented 1 year ago

Please try again. I'm releasing 0.0.14 that include supports for m1 wheels.

I can confirm 0.0.14 now works on MacOS. Thanks!