beidaochuan
@beidaochuan (トウ 宇川)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Scipyがインストールできません。

やりたいこと

  • Raspberry Pi OSのDocker環境で機械学習の開発環境を構築すること。

作業したこと

Raspberry Pi OS

  1. OS情報 (lsb_release -a)

        No LSB modules are available.
        Distributor ID:	Raspbian
        Description:	Raspbian GNU/Linux 11 (bullseye)
        Release:	11
        Codename:	bullseye
    
  2. OSバージョン (cat /etc/debian_version)

        11.6
    
  3. kernal情報 (cat /proc/version)

        Linux version 5.15.84-v7l+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1613 SMP Thu Jan 5 12:01:26 GMT 2023
    

Docker

Getting Started With Docker On Raspberry Pi (Full Guide) を参考した。

Python

docker pull python:3.11.0-bullseye でインストールしました。

機械学習などのモジュール

  • pip install numpy
  • pip install matplotlib
  • pip install seaborn
  • pip install scipy
    • ここで下記エラーが発生しました。

発生しているエラー

root@505bb7d6fcd3:/# pip install scipy
Collecting scipy
  Downloading scipy-1.10.0.tar.gz (42.4 MB)
     ???????????????????????????????????????? 42.4/42.4 MB 1.8 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... error
  error: subprocess-exited-with-error
  
  ラ pip subprocess to install backend dependencies did not run successfully.
  ? exit code: 1
  ??> [64 lines of output]
      Collecting ninja>=1.8.2
        Downloading ninja-1.11.1.tar.gz (27 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting patchelf>=0.11.0
        Downloading patchelf-0.17.0.0.tar.gz (166 kB)
           ??????????????????????????????????????? 166.8/166.8 kB 1.4 MB/s eta 0:00:00
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Building wheels for collected packages: ninja, patchelf
        Building wheel for ninja (pyproject.toml): started
        Building wheel for ninja (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        ラ Building wheel for ninja (pyproject.toml) did not run successfully.
        ? exit code: 1
        ??> [11 lines of output]
            Traceback (most recent call last):
              File "/tmp/pip-build-env-8o9e6mlk/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 612, in setup
                cmkr = cmaker.CMaker(cmake_executable)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/tmp/pip-build-env-8o9e6mlk/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 149, in __init__
                self.cmake_version = get_cmake_version(self.cmake_executable)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/tmp/pip-build-env-8o9e6mlk/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 104, in get_cmake_version
                raise SKBuildError(
      
            Problem with the CMake installation, aborting build. CMake executable is cmake
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for ninja
        Building wheel for patchelf (pyproject.toml): started
        Building wheel for patchelf (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        ラ Building wheel for patchelf (pyproject.toml) did not run successfully.
        ? exit code: 1
        ??> [11 lines of output]
            Traceback (most recent call last):
              File "/tmp/pip-build-env-j3s3rj5m/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 612, in setup
                cmkr = cmaker.CMaker(cmake_executable)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/tmp/pip-build-env-j3s3rj5m/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 149, in __init__
                self.cmake_version = get_cmake_version(self.cmake_executable)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/tmp/pip-build-env-j3s3rj5m/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 104, in get_cmake_version
                raise SKBuildError(
      
            Problem with the CMake installation, aborting build. CMake executable is cmake
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for patchelf
      Failed to build ninja patchelf
      ERROR: Could not build wheels for ninja, patchelf, which is required to install pyproject.toml-based projects
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

ラ pip subprocess to install backend dependencies did not run successfully.
? exit code: 1
??> See above for output.

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

自分で試したこと

RaspberryPiのライブラリがたりないかなと思いましたが、

sudo apt-get install libcblas-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libbz2-dev
sudo apt-get install libncurses5-dev
sudo apt-get install libffi-dev
sudo apt-get install libreadline-dev
sudo apt-get install libssl
sudo apt-get install libsqlite3-dev
sudo apt-get install liblzma-dev-dev
sudo apt cmake

などを入れてもダメでした。

ちなみにDockerではなく、Raspberry Pi直接にインストールできました。

教えて頂ければ幸いです。

また、一般的にRaspberry Piでscikit-learnを構築した際にどのように作業されているのでしょうか。経験者に教えて頂きたいです。

0

1Answer

WARNING: You are using pip version 21.2.4; however, version 22.3.1 is available.
  You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.

ってpipが古いよって言われてるし

https://stackoverflow.com/questions/61365790/error-could-not-build-wheels-for-scipy-which-use-pep-517-and-cannot-be-installe
類似事例もpipが古いとダメって書いてあったからバージョンアップしてみたらどうでしょう

後説教臭いですが

下記条件でScipyのインストールを行っています
Raspberry Pi 4B model (2022-9-22 Bullseye OS)
Docker
Python

ちゃんとDockerやPythonのバージョンも書かないと条件を書いたことにはなりませんよ

Docker --> Python3までインストールできて、そしてNumpy、Matplotlibとかもできていますが

インストールってなにでインストールしたんですか?自分でソースコードをcloneしてビルドしたんですか?apt installですか?またはpipでしょうか
それともcondaとかpyenvみたいな仮想環境経由ですか?

ちゃんと全部書かないと解決に至らないかもしれませんよ。

0Like

Comments

  1. @beidaochuan

    Questioner

    コメント頂き、ありがとうございます。
    pipのバージョンを変更しても変わらないです。
    書いて頂いた記事を含めて色々調査しましたが、解決せず投稿した次第です。

    またご指摘のように情報追記しました。
  2. こんにちわお疲れ様です、

    こちらのエラーを拝見しているとcmake周りに問題があるように思えます

    ```
    File "/tmp/pip-build-env-j3s3rj5m/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 104, in get_cmake_version
    raise SKBuildError(

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for patchelf
    ```


    ```
    $ cmake -version
    cmake version 3.25.1
    ```


    みたくcmakeのバージョンを確認して、入ってないとか異常に古いようであれば
    apt install などを試みてはいかがでしょうか

    (なんかうまくシンタックスハイライトが効かなくて辛い)



Your answer might help someone💌