人工知性を作りたい

私が日々、挑戦したことや学んだことなどを紹介していく雑記ブログです。 (新しいAI技術HTM, 専門の音声信号処理, 趣味のアニメ等も書いてます。)

librosa install error - Python2.7 Ubuntu20.04 venv仮想環境【個人備忘録】

 

 librosaのインストール出来ない問題の解決です。

原因は特定していません。

 

エラーログ

Requirement already satisfied: enum34; python_version < "3.4" in ./venv_how_dence/lib/python2.7/site-packages (from numba>=0.38.0->librosa) (1.1.10)
Collecting llvmlite>=0.31.0dev0
  Using cached llvmlite-0.32.1.tar.gz (104 kB)
Building wheels for collected packages: llvmlite
  Building wheel for llvmlite (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /work/hiro877/study/research/htmpapers/arxiv/how_can_we_be_so_dense/venv_how_dence/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-iIS9M1/llvmlite/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iIS9M1/llvmlite/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-eIW54v
       cwd: /tmp/pip-install-iIS9M1/llvmlite/
  Complete output (7 lines):
  running bdist_wheel
  /work/hiro877/study/research/htmpapers/arxiv/how_can_we_be_so_dense/venv_how_dence/bin/python /tmp/pip-install-iIS9M1/llvmlite/ffi/build.py
    File "/tmp/pip-install-iIS9M1/llvmlite/ffi/build.py", line 122
      raise ValueError(msg.format(_ver_check_skip)) from e
                                                       ^
  SyntaxError: invalid syntax
  error: command '/work/hiro877/study/research/htmpapers/arxiv/how_can_we_be_so_dense/venv_how_dence/bin/python' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Failed to build llvmlite
Installing collected packages: llvmlite, numba
    Running setup.py install for llvmlite ... error
    ERROR: Command errored out with exit status 1:
     command: /work/hiro877/study/research/htmpapers/arxiv/how_can_we_be_so_dense/venv_how_dence/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-iIS9M1/llvmlite/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iIS9M1/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-pCD67H/install-record.txt --single-version-externally-managed --compile --install-headers /work/hiro877/study/research/htmpapers/arxiv/how_can_we_be_so_dense/venv_how_dence/include/site/python2.7/llvmlite
         cwd: /tmp/pip-install-iIS9M1/llvmlite/
    Complete output (10 lines):
    running install
    running build
    got version from file /tmp/pip-install-iIS9M1/llvmlite/llvmlite/_version.py {'version': '0.32.1', 'full': 'aa11b129c0b55973067422397821ae6d44fa5e70'}
    running build_ext
    /work/hiro877/study/research/htmpapers/arxiv/how_can_we_be_so_dense/venv_how_dence/bin/python /tmp/pip-install-iIS9M1/llvmlite/ffi/build.py
      File "/tmp/pip-install-iIS9M1/llvmlite/ffi/build.py", line 122
        raise ValueError(msg.format(_ver_check_skip)) from e
                                                         ^
    SyntaxError: invalid syntax
    error: command '/work/hiro877/study/research/htmpapers/arxiv/how_can_we_be_so_dense/venv_how_dence/bin/python' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /work/hiro877/study/research/htmpapers/arxiv/how_can_we_be_so_dense/venv_how_dence/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-iIS9M1/llvmlite/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iIS9M1/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-pCD67H/install-record.txt --single-version-externally-managed --compile --install-headers /work/hiro877/study/research/htmpapers/arxiv/how_can_we_be_so_dense/venv_how_dence/include/site/python2.7/llvmlite Check the logs for full command output.

 

解決策

LLVM_CONFIG=/usr/bin/llvm-config pip install llvmlite==0.31.0 numba==0.48.0 colorama==0.3.9 librosa==0.6.3

 

【予想原因】

・pipがLLVMのライブラリのPathを分かっていない

・librosaのバージョンとと対応するllvmliteなどが必要