質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Raspberry Pi

Raspberry Piは、ラズベリーパイ財団が開発した、名刺サイズのLinuxコンピュータです。 学校で基本的なコンピュータ科学の教育を促進することを意図しています。

Q&A

2回答

5945閲覧

Raspberry PiにおけるPython3.7へのnumbaライブラリのインストールができません。

hamatori

総合スコア0

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Raspberry Pi

Raspberry Piは、ラズベリーパイ財団が開発した、名刺サイズのLinuxコンピュータです。 学校で基本的なコンピュータ科学の教育を促進することを意図しています。

0グッド

0クリップ

投稿2022/02/08 08:50

編集2022/02/27 19:36

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

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

jbpb0

2022/02/08 12:46

> pi@raspberrypi:/usr/bin $ ln -s llvm-config-9 llvm-config ln: シンボリックリンク 'llvm-config' の作成に失敗しました: ファイルが存在します ls -l /usr/bin/llvm-config を実行した結果を教えてください
hamatori

2022/02/09 05:01

ご質問ありがとうございます。 以下のようになりました。 pi@raspberrypi:~ $ ls -l /usr/bin/llvm-config lrwxrwxrwx 1 root root 29 12月 26 2018 /usr/bin/llvm-config -> ../lib/llvm-7/bin/llvm-config
jbpb0

2022/02/09 07:59 編集

> pi@raspberrypi:/usr/bin $ ln -s llvm-config-9 llvm-config ln: シンボリックリンク 'llvm-config' の作成に失敗しました: ファイルが存在します の実行に失敗したために、下記の通り「/usr/bin/llvm-config」は現状LLVM 7の「llvm-config」ファイルを指したままですね > lrwxrwxrwx 1 root root 29 12月 26 2018 /usr/bin/llvm-config -> ../lib/llvm-7/bin/llvm-config そのため、aptでインストールしたLLVM 9が使われず、LLVM 7が使われて、下記のエラーになってるのだと思います > RuntimeError: Building llvmlite requires LLVM 10.0.x or 9.0.x, got '7.0.1'. cd /usr/bin sudo mv llvm-config llvm-config-7 sudo ln -s llvm-config-9 llvm-config を実行したら、「/usr/bin/llvm-config」がLLVM 9の「llvm-config-9」を指すようになり、LLVM 9が使われて、エラー出なくなるのではないですかね
hamatori

2022/02/15 08:40

返信が遅くなり申し訳ありませんでした。 ご教授いただいた方法で、正常にnumbaライブラリをインストールすることができました。 本当にありがとうございました。
guest

回答2

0

pi@raspberrypi:/usr/bin $ ln -s llvm-config-9 llvm-config
ln: シンボリックリンク 'llvm-config' の作成に失敗しました: ファイルが存在します

の実行に失敗したために、下記の通り「/usr/bin/llvm-config」は現状LLVM 7の「llvm-config」ファイルを指したままです

lrwxrwxrwx 1 root root 29 12月 26 2018 /usr/bin/llvm-config -> ../lib/llvm-7/bin/llvm-config

そのため、aptでインストールしたLLVM 9が使われず、LLVM 7が使われて、下記のエラーになってるのだと思います

RuntimeError: Building llvmlite requires LLVM 10.0.x or 9.0.x, got '7.0.1'.

 

sh

1cd /usr/bin 2sudo mv llvm-config llvm-config-7 3sudo ln -s llvm-config-9 llvm-config

を実行したら、「/usr/bin/llvm-config」がLLVM 9の「llvm-config-9」を指すようになり、LLVM 9が使われて、エラーが出なくなると思います

投稿2022/02/27 10:36

jbpb0

総合スコア7651

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

今手元にラズパイ4が無いのでラズパイ3で試してみましたが
普通にインストールできましたね。

Python 3.7.12 llvmlite 0.38.0 numba 0.55.1 numpy 1.21.5 pi@raspi1:$ python -c 'import numba; print(numba.__version__)' 0.55.1

出力されているエラーメッセージを一つずつ調べて潰していってください。

投稿2022/02/08 12:59

technocore

総合スコア7200

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

hamatori

2022/02/09 05:14

ご回答ありがとうございます。 エラーメッセージをさらに確認し、ラズパイ4あるいは本使用環境特有の問題ではないか調べてみます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問