how can install llvm11 in an apline image?

389 Views Asked by At

I am trying to install top2vec in an alpine docker image. however it is throwing error that did not find llvm-config.

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 132.8/132.8 kB 6.2 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: llvmlite
  Building wheel for llvmlite (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      running bdist_wheel
      /usr/local/bin/python /tmp/pip-install-zg50ooos/llvmlite_72eb3dc99df24ca8b202cb27e5bb87e9/ffi/build.py
      LLVM version... Traceback (most recent call last):
        File "/tmp/pip-install-zg50ooos/llvmlite_72eb3dc99df24ca8b202cb27e5bb87e9/ffi/build.py", line 226, in <module>
          main()
        File "/tmp/pip-install-zg50ooos/llvmlite_72eb3dc99df24ca8b202cb27e5bb87e9/ffi/build.py", line 216, in main
          main_posix('linux', '.so')
        File "/tmp/pip-install-zg50ooos/llvmlite_72eb3dc99df24ca8b202cb27e5bb87e9/ffi/build.py", line 135, in main_posix
          raise RuntimeError(msg) from None
      RuntimeError: Could not find a `llvm-config` binary. There are a number of reasons this could occur, please see: https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#using-pip for help.
      error: command '/usr/local/bin/python' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Failed to build llvmlite
Installing collected packages: llvmlite
  Running setup.py install for llvmlite ... error
  error: subprocess-exited-with-error

  × Running setup.py install for llvmlite did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running install
      running build
      got version from file /tmp/pip-install-zg50ooos/llvmlite_72eb3dc99df24ca8b202cb27e5bb87e9/llvmlite/_version.py {'version': '0.39.1', 'full': '31f808fa7a5796bb8d4b14e8a9e27c6dd15f2b6c'}
      running build_ext
      /usr/local/bin/python /tmp/pip-install-zg50ooos/llvmlite_72eb3dc99df24ca8b202cb27e5bb87e9/ffi/build.py
      LLVM version... Traceback (most recent call last):
        File "/tmp/pip-install-zg50ooos/llvmlite_72eb3dc99df24ca8b202cb27e5bb87e9/ffi/build.py", line 226, in <module>
          main()
        File "/tmp/pip-install-zg50ooos/llvmlite_72eb3dc99df24ca8b202cb27e5bb87e9/ffi/build.py", line 216, in main
          main_posix('linux', '.so')
        File "/tmp/pip-install-zg50ooos/llvmlite_72eb3dc99df24ca8b202cb27e5bb87e9/ffi/build.py", line 135, in main_posix
          raise RuntimeError(msg) from None
      RuntimeError: Could not find a `llvm-config` binary. There are a number of reasons this could occur, please see: https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#using-pip for help.
      error: command '/usr/local/bin/python' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> llvmlite

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

if I install llvm-dev, I can see llvm-config-12 but then get other error, saying it needs llvm-config-11. Now if you install it like apk add llvm11, there is no llvm-config for llvm11 and throwing error message RuntimeError: Could not find a `llvm-config` binary. Does anyone know how I can solve this problem?

1

There are 1 best solutions below

0
Davood On

I changed in my Dockerfile the base image from FROM python:3.9.12-alpine (based on Alpine Linux.) to FROM python:3.9.12 ( based on Debian). And now it is working.