Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run in Docker? #76

Open
leftmove opened this issue Oct 22, 2024 · 1 comment
Open

How to run in Docker? #76

leftmove opened this issue Oct 22, 2024 · 1 comment

Comments

@leftmove
Copy link

leftmove commented Oct 22, 2024

How can I run this library in Docker? Currently, when I include it in my dependencies, it says it cannot find the source file ggml.h, and that the wheel build failed. What does this mean?

Here is the error.

Using CPython 3.12.7 interpreter at: /usr/local/bin/python
Creating virtual environment at: .venv
Resolved 76 packages in 2.79s
error: Failed to prepare distributions
  Caused by: Failed to download and build `pywhispercpp==1.2.0`
  Caused by: Build backend failed to build wheel through `build_wheel` (exit status: 1)

[stdout]
running bdist_wheel
running build
running build_py
creating build/lib.linux-aarch64-cpython-312/pywhispercpp
copying ./pywhispercpp/utils.py -> build/lib.linux-aarch64-cpython-312/pywhispercpp
copying ./pywhispercpp/_logger.py -> build/lib.linux-aarch64-cpython-312/pywhispercpp
copying ./pywhispercpp/model.py -> build/lib.linux-aarch64-cpython-312/pywhispercpp
copying ./pywhispercpp/__init__.py -> build/lib.linux-aarch64-cpython-312/pywhispercpp
copying ./pywhispercpp/constants.py -> build/lib.linux-aarch64-cpython-312/pywhispercpp
creating build/lib.linux-aarch64-cpython-312/pywhispercpp/examples
copying ./pywhispercpp/examples/__init__.py -> build/lib.linux-aarch64-cpython-312/pywhispercpp/examples
copying ./pywhispercpp/examples/assistant.py -> build/lib.linux-aarch64-cpython-312/pywhispercpp/examples
copying ./pywhispercpp/examples/livestream.py -> build/lib.linux-aarch64-cpython-312/pywhispercpp/examples
copying ./pywhispercpp/examples/main.py -> build/lib.linux-aarch64-cpython-312/pywhispercpp/examples
copying ./pywhispercpp/examples/recording.py -> build/lib.linux-aarch64-cpython-312/pywhispercpp/examples
running build_ext
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- pybind11 v2.9.2 
-- Found PythonInterp: /root/.cache/uv/builds-v0/.tmplYIiSU/bin/python (found version "3.12.7")
-- Found PythonLibs: /usr/local/lib/libpython3.12.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- CMAKE_SYSTEM_PROCESSOR: aarch64
-- ARM detected
-- Configuring done (0.4s)

[stderr]
CMake Deprecation Warning at pybind11/CMakeLists.txt:8 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Warning (dev) at pybind11/tools/FindPythonLibsNew.cmake:98 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  pybind11/tools/pybind11Tools.cmake:50 (find_package)
  pybind11/tools/pybind11Common.cmake:206 (include)
  pybind11/CMakeLists.txt:200 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at whisper.cpp/CMakeLists.txt:468 (add_library):
  Cannot find source file:

    ggml.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
  .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
  .f95 .f03 .hip .ispc


CMake Error at whisper.cpp/CMakeLists.txt:468 (add_library):
  No SOURCES given to target: whisper


CMake Generate step failed.  Build files cannot be regenerated correctly.
Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/build_meta.py", line 431, in build_wheel
    return _build(['bdist_wheel'])
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/build_meta.py", line 422, in _build
    return self._build_with_temp_dir(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/build_meta.py", line 403, in _build_with_temp_dir
    self.run_setup()
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, in run_setup
    exec(code, locals())
  File "<string>", line 132, in <module>
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/__init__.py", line 117, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 183, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 199, in run_commands
    dist.run_commands()
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
    self.run_command(cmd)
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/dist.py", line 991, in run_command
    super().run_command(command)
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
    cmd_obj.run()
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/command/bdist_wheel.py", line 407, in run
    self.run_command("build")
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
    self.distribution.run_command(command)
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/dist.py", line 991, in run_command
    super().run_command(command)
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
    cmd_obj.run()
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
    self.distribution.run_command(command)
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/dist.py", line 991, in run_command
    super().run_command(command)
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
    cmd_obj.run()
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/command/build_ext.py", line 98, in run
    _build_ext.run(self)
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
    self.build_extensions()
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 476, in build_extensions
    self._build_extensions_serial()
  File "/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 502, in _build_extensions_serial
    self.build_extension(ext)
  File "<string>", line 118, in build_extension
  File "/usr/local/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['cmake', '/root/.cache/uv/sdists-v5/pypi/pywhispercpp/1.2.0/qU07NrZq-gfmEEDNyCqAL/pywhispercpp-1.2.0.tar.gz', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/root/.cache/uv/sdists-v5/pypi/pywhispercpp/1.2.0/qU07NrZq-gfmEEDNyCqAL/pywhispercpp-1.2.0.tar.gz/build/lib.linux-aarch64-cpython-312/', '-DPYTHON_EXECUTABLE=/root/.cache/uv/builds-v0/.tmplYIiSU/bin/python', '-DCMAKE_BUILD_TYPE=Release', '-DEXAMPLE_VERSION_INFO=1.2.0', '-GNinja', '-DCMAKE_MAKE_PROGRAM:FILEPATH=/root/.cache/uv/builds-v0/.tmplYIiSU/lib/python3.12/site-packages/ninja/data/bin/ninja']' returned non-zero exit status 1.
The command '/bin/sh -c uv sync' returned a non-zero code: 2

Here is my Dockerfile.

FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim

WORKDIR /app

COPY pyproject.toml /app/pyproject.toml
COPY main.py /app/main.py
COPY routers /app/routers
COPY prompts /app/prompts
COPY outputs /app/outputs
COPY audio /app/audio

RUN apt update
RUN apt install -y build-essential ffmpeg
RUN uv sync

COPY .env /app/.env
COPY env.py /app/env.py

EXPOSE ${PORT}

CMD ["uv", "run", "python", "main.py"]

I use uv if that's relevant. Here is the dependencies section of my pyproject.toml.

dependencies = [
    "fastapi>=0.115.0",
    "google-generativeai>=0.8.2",
    "jsonpickle>=3.3.0",
    "more-itertools==10.5.0",
    "numba==0.60.0",
    "numpy==2.0.2",
    "pydub>=0.25.1",
    "python-dotenv>=1.0.1",
    "python-multipart>=0.0.12",
    "pywhispercpp>=1.2.0",
    "regex==2024.9.11",
    "soundfile>=0.12.1",
    "supabase>=2.8.1",
    "tiktoken==0.8.0",
    "uvicorn>=0.31.0",
]
@absadiki
Copy link
Owner

@leftmove, it seems like you are using an ARM machine. There are no pre-built wheels for arm in the current PYPI version unfortunately.
I'll try to include it in the next release.
In the meantime, You can try to build it from the source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants