2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

numbaインストール時のLLVMエラーの原因と解決法

Posted at

実行環境

Ubuntu:18.04
python:3.8.0
numba:0.55.1

numbaをinstall時に下記のエラーが発生

実行コマンド
$ pip install numba
エラー全文
Collecting numba
  Using cached https://files.pythonhosted.org/packages/69/df/bd36068b2c1d0d34794f8ac0c222f9c4ad88dc710b400e65dbb3b59ea57e/numba-0.55.1.tar.gz
Collecting llvmlite<0.39,>=0.38.0rc1 (from numba)
  Using cached https://files.pythonhosted.org/packages/d8/e3/bd329a96549809598acd5daaccd35fd9d0883185cfe7f681a9e3e54beaa0/llvmlite-0.38.0.tar.gz
Collecting numpy<1.22,>=1.18 (from numba)
  Using cached https://files.pythonhosted.org/packages/d5/43/e88bb1fb7d040ae8e0e06e749341b13f57701aab11fe9d71c99af6202c5c/numpy-1.21.6-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Requirement already satisfied: setuptools in /home/$(user)/.pyenv/versions/3.8.0/envs/$(virtualenv name)/lib/python3.8/site-packages (from numba) (41.2.0)
Installing collected packages: llvmlite, numpy, numba
  Running setup.py install for llvmlite ... error
    ERROR: Command errored out with exit status 1:
     command: /home/$(user)/.pyenv/versions/3.8.0/envs/$(virtualenv name)/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-0e_cn8e1/llvmlite/setup.py'"'"'; __file__='"'"'/tmp/pip-install-0e_cn8e1/llvmlite/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-n9rj4frp/install-record.txt --single-version-externally-managed --compile --install-headers /home/$(user)/.pyenv/versions/3.8.0/envs/$(virtualenv name)/include/site/python3.8/llvmlite
         cwd: /tmp/pip-install-0e_cn8e1/llvmlite/
    Complete output (18 lines):
    running install
    running build
    got version from file /tmp/pip-install-0e_cn8e1/llvmlite/llvmlite/_version.py {'version': '0.38.0', 'full': 'f0365b91ce1e1f74c68785c6d0067f32f89857d9'}
    running build_ext
    /home/muratam39/.pyenv/versions/3.8.0/envs/call/bin/python3.8 /tmp/pip-install-0e_cn8e1/llvmlite/ffi/build.py
    LLVM version... 6.0.0
    
    Traceback (most recent call last):
      File "/tmp/pip-install-0e_cn8e1/llvmlite/ffi/build.py", line 220, in <module>
        main()
      File "/tmp/pip-install-0e_cn8e1/llvmlite/ffi/build.py", line 210, in main
        main_posix('linux', '.so')
      File "/tmp/pip-install-0e_cn8e1/llvmlite/ffi/build.py", line 172, in main_posix
        raise RuntimeError(msg)
    RuntimeError: Building llvmlite requires LLVM 11.x.x, got '6.0.0'. Be sure to set LLVM_CONFIG to the right executable path.
    Read the documentation at http://llvmlite.pydata.org/ for more information about building llvmlite.
    
    error: command '/home/$(user)/.pyenv/versions/3.8.0/envs/$(virtualenv name)/bin/python3.8' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/$(user)/.pyenv/versions/3.8.0/envs/$(virtualenv name)/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-0e_cn8e1/llvmlite/setup.py'"'"'; __file__='"'"'/tmp/pip-install-0e_cn8e1/llvmlite/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-n9rj4frp/install-record.txt --single-version-externally-managed --compile --install-headers /home/$(user)/.pyenv/versions/3.8.0/envs/$(virtualenv name)/include/site/python3.8/llvmlite Check the logs for full command output.

原因と解決策

原因箇所
RuntimeError: Building llvmlite requires LLVM 11.x.x, got '6.0.0'. Be sure to set LLVM_CONFIG to the right executable path.

llvmliteのbuild時に必要なLLVMライブラリのバージョンが違うことが原因。
下記のコマンドを実行して、LLVMライブラリのバージョンを必要なものと合わせてから再インストールすると解決する。

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh <version number>(今回で言うと11)

export LLVM_CONFIG=/usr/bin/llvm-config-11  # パスを通す

pip install numba
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?