kvcache-ai / ktransformers

A Flexible Framework for Experiencing Cutting-edge LLM Inference Optimizations
Apache License 2.0
741 stars 39 forks source link

docker builds and pip install broken - No module named 'cpufeature' #61

Closed sammcj closed 2 months ago

sammcj commented 2 months ago

Building from the stock Dockerfile in the repo fails looking for a package called 'cpufeature':

51.85 Successfully installed einops-0.8.0 flash-attn-2.6.3
51.85 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
52.09 Using pip 24.0 from /opt/conda/lib/python3.10/site-packages/pip (python 3.10)
52.11 Processing /workspace/ktransformers
52.11   Preparing metadata (pyproject.toml): started
52.11   Running command Preparing metadata (pyproject.toml)
52.79   Traceback (most recent call last):
52.79     File "/opt/conda/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
52.79       main()
52.79     File "/opt/conda/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
52.79       json_out['return_val'] = hook(**hook_input['kwargs'])
52.79     File "/opt/conda/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
52.79       return hook(metadata_directory, config_settings)
52.79     File "/opt/conda/lib/python3.10/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
52.79       self.run_setup()
52.79     File "/opt/conda/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
52.79       exec(code, locals())
52.79     File "<string>", line 31, in <module>
52.79   ModuleNotFoundError: No module named 'cpufeature'
52.97   error: subprocess-exited-with-error
52.97
52.97   × Preparing metadata (pyproject.toml) did not run successfully.
52.97   │ exit code: 1
52.97   ╰─> See above for output.
52.97
52.97   note: This error originates from a subprocess, and is likely not a problem with pip.
52.97   full command: /opt/conda/bin/python /opt/conda/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpxsqhf4x8
52.97   cwd: /workspace/ktransformers
52.97   Preparing metadata (pyproject.toml): finished with status 'error'
52.97 error: metadata-generation-failed
52.97
52.97 × Encountered error while generating package metadata.
52.97 ╰─> See above for output.
52.97
52.97 note: This is an issue with the package mentioned above, not pip.
52.97 hint: See above for details.
------
failed to solve: process "/bin/sh -c apt update -y &&  apt install -y  --no-install-recommends \\\n    git \\\n    wget \\\n    vim \\\n    gcc \\\n    g++ \\\n    cmake && \nrm -rf /var/lib/apt/lists/* &&\ncd ktransformers &&\ngit submodule init &&\ngit submodule update &&\npip install ninja pyproject numpy &&\npip install flash-attn &&\nCPU_INSTRUCT=NATIVE  KTRANSFORMERS_FORCE_BUILD=TRUE TORCH_CUDA_ARCH_LIST=\"8.0;8.6;8.7;8.9\" pip install . --no-build-isolation --verbose &&\npip cache purge\n" did not complete successfully: exit code: 1
sammcj commented 2 months ago

Looks like non-docker builds are broken as well:

pip install ktransformers --no-build-isolation
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting ktransformers
  Downloading ktransformers-0.1.2.tar.gz (6.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.6/6.6 MB 4.4 MB/s eta 0:00:00
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      /root/.conda/envs/ktransformers/lib/python3.11/site-packages/torch/_subclasses/functional_tensor.py:258: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:84.)
        cpu = _conversion_method_template(device=torch.device("cpu"))
      Traceback (most recent call last):
        File "/root/.conda/envs/ktransformers/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/root/.conda/envs/ktransformers/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/root/.conda/envs/ktransformers/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/root/.conda/envs/ktransformers/lib/python3.11/site-packages/setuptools/build_meta.py", line 368, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/root/.conda/envs/ktransformers/lib/python3.11/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 31, in <module>
      ModuleNotFoundError: No module named 'cpufeature'
      [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.
Azure-Tang commented 2 months ago

Sorry for inconvenience, it seems that we didn't update our dockerfile. We will fix this by next pr/release. Before that, you may enter your container and use pip install cpufeature to fix this.

sammcj commented 2 months ago

Thanks Azure, confirming you latest update has resolved this!

sammcj commented 2 months ago

But there's another missing package... uvicorn - I'll log a new relevant ticket for it.

sammcj commented 2 months ago

https://github.com/kvcache-ai/ktransformers/issues/66