Raspberry Pi4Bにおいて、Python3.7へnumbaライブラリをインストールし、@jitの機能によってプログラムの高速処理を図ろうと考えています。
しかしながら、numbaライブラリのインストールに失敗してしまい、困っています。
下記のコードをLxTerminalに入力し実行しました。
$ sudo apt install llvm-9 $ cd /usr/bin $ ln -s llvm-config-9 llvm-config $ pip3 install numba==0.53.1
実行した結果、表示されたエラーについては下記の通りです。
pi@raspberrypi:/usr/bin $ sudo apt install llvm-9 パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 llvm-9 はすでに最新バージョン (1:9.0.1-6+rpi1~bpo10+1) です。 アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。 pi@raspberrypi:/usr/bin $ cd /usr/bin pi@raspberrypi:/usr/bin $ ln -s llvm-config-9 llvm-config ln: シンボリックリンク 'llvm-config' の作成に失敗しました: ファイルが存在します pi@raspberrypi:/usr/bin $ pip3 install numba==0.53.1 Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting numba==0.53.1 Using cached https://www.piwheels.org/simple/numba/numba-0.53.1-cp37-cp37m-linux_armv7l.whl (3.0 MB) Requirement already satisfied: setuptools in /home/pi/.local/lib/python3.7/site-packages (from numba==0.53.1) (60.7.1) Requirement already satisfied: numpy>=1.15 in /usr/local/lib/python3.7/dist-packages (from numba==0.53.1) (1.21.3) Collecting llvmlite<0.37,>=0.36.0rc1 Using cached llvmlite-0.36.0.tar.gz (126 kB) 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 ╰─> [14 lines of output] running bdist_wheel LLVM version... 7.0.1 Traceback (most recent call last): File "/tmp/pip-install-awb__bdi/llvmlite_aa78319e70594c14b49ec40ab427ef30/ffi/build.py", line 220, in <module> main() File "/tmp/pip-install-awb__bdi/llvmlite_aa78319e70594c14b49ec40ab427ef30/ffi/build.py", line 210, in main main_posix('linux', '.so') File "/tmp/pip-install-awb__bdi/llvmlite_aa78319e70594c14b49ec40ab427ef30/ffi/build.py", line 172, in main_posix raise RuntimeError(msg) RuntimeError: Building llvmlite requires LLVM 10.0.x or 9.0.x, got '7.0.1'. 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 '/usr/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, numba 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 ╰─> [19 lines of output] running install /home/pi/.local/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. setuptools.SetuptoolsDeprecationWarning, running build got version from file /tmp/pip-install-awb__bdi/llvmlite_aa78319e70594c14b49ec40ab427ef30/llvmlite/_version.py {'version': '0.36.0', 'full': 'e6bb8d137d922bec8beeb01a237254778759becd'} running build_ext LLVM version... 7.0.1 Traceback (most recent call last): File "/tmp/pip-install-awb__bdi/llvmlite_aa78319e70594c14b49ec40ab427ef30/ffi/build.py", line 220, in <module> main() File "/tmp/pip-install-awb__bdi/llvmlite_aa78319e70594c14b49ec40ab427ef30/ffi/build.py", line 210, in main main_posix('linux', '.so') File "/tmp/pip-install-awb__bdi/llvmlite_aa78319e70594c14b49ec40ab427ef30/ffi/build.py", line 172, in main_posix raise RuntimeError(msg) RuntimeError: Building llvmlite requires LLVM 10.0.x or 9.0.x, got '7.0.1'. 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 '/usr/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.
またこれらは下記リンクのページを参考に行いました。
Qiita:raspi3B+にnumba-0.53.1をインストールする
使用環境は以下の通りです。
使用デバイス:Raspberry Pi 4 modelB (4GB)
OS:Raspberry Pi OS(Raspberry PiImagerを使用しインストール)
Pythonaバージョン:Python3.73
もしインストールに成功した方や知見のある方がいらっしゃいましたら、アドバイスいただけますと非常にありがたいです。
初心者かつ素人ではありますが、どうかよろしくお願いいたします。
【追記】2022/02/09
下記コードをLxTerminalで実行した結果、ホームフォルダ(pi)直下にnumbaライブラリのフォルダがインストールされてしまい、python上で「from numba import jit」を実行してもエラーとなってしまいました。「import numba」を実行した場合はエラーは出ませんでしたが、@jitの機能は使用できませんでした。
pi@raspberrypi:~ $ sudo apt-get install llvm pi@raspberrypi:~ $ git clone https://github.com/numba/numba.git
