PR

ERROR: Failed building wheel for mpi4py

「ERROR: Failed building wheel for mpi4py」に対する対処法の紹介

スポンサーリンク

エラー

Ubuntuでmpi4pyをインストールしようとしたらこんなエラーが出た

mtkbirdman@DESKTOP-XXXXXXX:$ pip3 install mpi4py
Defaulting to user installation because normal site-packages is not writeable
Collecting mpi4py
  Using cached mpi4py-3.1.3.tar.gz (2.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mpi4py
  Building wheel for mpi4py (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for mpi4py (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [148 lines of output]
      running bdist_wheel
      running build
      running build_src
	:
      failure.
      removing: _configtest.c _configtest.o
      error: Cannot compile MPI programs. Check your configuration!!!
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mpi4py
Failed to build mpi4py
ERROR: Could not build wheels for mpi4py, which is required to install pyproject.toml-based projects

原因

Failed building wheel for mpi4py - 雑多な技術系メモ

対処法

libopenmpi-devをインストールする

sudo apt install libopenmpi-dev
mtkbirdman@DESKTOP-8OV3GB0:~$ sudo apt install libopenmpi-dev
[sudo] password for mtkbirdman:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  autoconf automake autotools-dev ibverbs-providers libcaf-openmpi-3 libcoarrays-dev libcoarrays-openmpi-dev
  libevent-core-2.1-7 libevent-dev libevent-extra-2.1-7 libevent-openssl-2.1-7 libevent-pthreads-2.1-7 libfabric1
  libhwloc-dev libhwloc-plugins libhwloc15 libibverbs-dev libibverbs1 libltdl-dev libnl-3-200 libnl-3-dev
  libnl-route-3-200 libnl-route-3-dev libnuma-dev libopenmpi3 libpmix2 libpsm-infinipath1 libpsm2-2 librdmacm1
  libtool libxnvctrl0 m4 ocl-icd-libopencl1 openmpi-bin openmpi-common
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc gettext libhwloc-contrib-plugins libtool-doc openmpi-doc gcj-jdk
  m4-doc opencl-icd
The following NEW packages will be installed:
  autoconf automake autotools-dev ibverbs-providers libcaf-openmpi-3 libcoarrays-dev libcoarrays-openmpi-dev
  libevent-core-2.1-7 libevent-dev libevent-extra-2.1-7 libevent-openssl-2.1-7 libevent-pthreads-2.1-7 libfabric1
  libhwloc-dev libhwloc-plugins libhwloc15 libibverbs-dev libibverbs1 libltdl-dev libnl-3-200 libnl-3-dev
  libnl-route-3-200 libnl-route-3-dev libnuma-dev libopenmpi-dev libopenmpi3 libpmix2 libpsm-infinipath1 libpsm2-2
  librdmacm1 libtool libxnvctrl0 m4 ocl-icd-libopencl1 openmpi-bin openmpi-common
0 upgraded, 36 newly installed, 0 to remove and 129 not upgraded.
Need to get 7598 kB/7798 kB of archives.
After this operation, 33.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 autoconf all 2.69-11.1 [321 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 autotools-dev all 20180224.1 [39.6 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 automake all 1:1.16.1-4ubuntu6 [522 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 libnl-3-200 amd64 3.4.0-1 [53.9 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 libnl-route-3-200 amd64 3.4.0-1 [149 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 libibverbs1 amd64 28.0-1ubuntu1 [53.6 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/main amd64 ibverbs-providers amd64 28.0-1ubuntu1 [232 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 libevent-core-2.1-7 amd64 2.1.11-stable-1 [89.1 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 libevent-pthreads-2.1-7 amd64 2.1.11-stable-1 [7372 B]
Get:10 http://archive.ubuntu.com/ubuntu focal/universe amd64 libpsm-infinipath1 amd64 3.3+20.604758e7-6 [168 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/universe amd64 libpsm2-2 amd64 11.2.86-1 [178 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 librdmacm1 amd64 28.0-1ubuntu1 [64.9 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal/universe amd64 libfabric1 amd64 1.6.2-3 [396 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/universe amd64 libhwloc15 amd64 2.1.0+dfsg-4 [134 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libxnvctrl0 amd64 470.57.01-0ubuntu0.20.04.3 [10.9 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal/main amd64 ocl-icd-libopencl1 amd64 2.2.11-1ubuntu1 [30.3 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal/universe amd64 libhwloc-plugins amd64 2.1.0+dfsg-4 [14.4 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal/universe amd64 libpmix2 amd64 3.1.5-1 [442 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal/universe amd64 libopenmpi3 amd64 4.0.3-0ubuntu1 [1978 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal/universe amd64 libcaf-openmpi-3 amd64 2.8.0-1 [35.5 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal/universe amd64 libcoarrays-dev amd64 2.8.0-1 [28.2 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal/universe amd64 openmpi-common all 4.0.3-0ubuntu1 [151 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal/universe amd64 openmpi-bin amd64 4.0.3-0ubuntu1 [67.4 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal/universe amd64 libcoarrays-openmpi-dev amd64 2.8.0-1 [34.2 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal/main amd64 libevent-extra-2.1-7 amd64 2.1.11-stable-1 [60.0 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal/main amd64 libevent-openssl-2.1-7 amd64 2.1.11-stable-1 [14.3 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal/main amd64 libevent-dev amd64 2.1.11-stable-1 [261 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal/main amd64 libltdl-dev amd64 2.4.6-14 [162 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal/main amd64 libnl-3-dev amd64 3.4.0-1 [92.2 kB]
Get:30 http://archive.ubuntu.com/ubuntu focal/main amd64 libnl-route-3-dev amd64 3.4.0-1 [166 kB]
Get:31 http://archive.ubuntu.com/ubuntu focal/main amd64 libtool all 2.4.6-14 [161 kB]
Get:32 http://archive.ubuntu.com/ubuntu focal/main amd64 libnuma-dev amd64 2.0.12-1 [32.4 kB]
Get:33 http://archive.ubuntu.com/ubuntu focal/universe amd64 libhwloc-dev amd64 2.1.0+dfsg-4 [205 kB]
Get:34 http://archive.ubuntu.com/ubuntu focal/main amd64 libibverbs-dev amd64 28.0-1ubuntu1 [444 kB]
Get:35 http://archive.ubuntu.com/ubuntu focal/universe amd64 libopenmpi-dev amd64 4.0.3-0ubuntu1 [798 kB]
Fetched 7598 kB in 28s (267 kB/s)
Extracting templates from packages: 100%
Selecting previously unselected package m4.
(Reading database ... 40962 files and directories currently installed.)
Preparing to unpack .../00-m4_1.4.18-4_amd64.deb ...
Unpacking m4 (1.4.18-4) ...
Selecting previously unselected package autoconf.
Preparing to unpack .../01-autoconf_2.69-11.1_all.deb ...
Unpacking autoconf (2.69-11.1) ...
Selecting previously unselected package autotools-dev.
Preparing to unpack .../02-autotools-dev_20180224.1_all.deb ...
Unpacking autotools-dev (20180224.1) ...
Selecting previously unselected package automake.
Preparing to unpack .../03-automake_1%3a1.16.1-4ubuntu6_all.deb ...
Unpacking automake (1:1.16.1-4ubuntu6) ...
Selecting previously unselected package libnl-3-200:amd64.
Unpacking libnl-3-200:amd64 (3.4.0-1) ...................................................................................................................................................................................................]
Unpacking libnl-route-3-200:amd64 (3.4.0-1) .............................................................................................................................................................................................]
Selecting previously unselected package libibverbs1:amd64................................................................................................................................................................................]
Preparing to unpack .../06-libibverbs1_28.0-1ubuntu1_amd64.deb ...
Unpacking libibverbs1:amd64 (28.0-1ubuntu1) ...
Selecting previously unselected package ibverbs-providers:amd64..........................................................................................................................................................................]
Preparing to unpack .../07-ibverbs-providers_28.0-1ubuntu1_amd64.deb ...
Unpacking ibverbs-providers:amd64 (28.0-1ubuntu1) .......................................................................................................................................................................................]
Selecting previously unselected package libevent-core-2.1-7:amd64........................................................................................................................................................................]
Preparing to unpack .../08-libevent-core-2.1-7_2.1.11-stable-1_amd64.deb ...
Unpacking libevent-core-2.1-7:amd64 (2.1.11-stable-1) ...
Selecting previously unselected package libevent-pthreads-2.1-7:amd64....................................................................................................................................................................]
Preparing to unpack .../09-libevent-pthreads-2.1-7_2.1.11-stable-1_amd64.deb ...
Unpacking libevent-pthreads-2.1-7:amd64 (2.1.11-stable-1) ...............................................................................................................................................................................]
Selecting previously unselected package libpsm-infinipath1.
Preparing to unpack .../10-libpsm-infinipath1_3.3+20.604758e7-6_amd64.deb ...
Unpacking libpsm-infinipath1 (3.3+20.604758e7-6) ........................................................................................................................................................................................]
Selecting previously unselected package libpsm2-2........................................................................................................................................................................................]
Preparing to unpack .../11-libpsm2-2_11.2.86-1_amd64.deb ...
Unpacking libpsm2-2 (11.2.86-1) ...
Selecting previously unselected package librdmacm1:amd64.................................................................................................................................................................................]
Preparing to unpack .../12-librdmacm1_28.0-1ubuntu1_amd64.deb ...
Unpacking librdmacm1:amd64 (28.0-1ubuntu1) ...#########..................................................................................................................................................................................]
Selecting previously unselected package libfabric1.
Preparing to unpack .../13-libfabric1_1.6.2-3_amd64.deb ...
Unpacking libfabric1 (1.6.2-3) ...########################...............................................................................................................................................................................]
Selecting previously unselected package libhwloc15:amd64.##..............................................................................................................................................................................]
Preparing to unpack .../14-libhwloc15_2.1.0+dfsg-4_amd64.deb ...
Unpacking libhwloc15:amd64 (2.1.0+dfsg-4) ...################............................................................................................................................................................................]
Selecting previously unselected package libxnvctrl0:amd64.
Preparing to unpack .../15-libxnvctrl0_470.57.01-0ubuntu0.20.04.3_amd64.deb ...
Unpacking libxnvctrl0:amd64 (470.57.01-0ubuntu0.20.04.3) ...###..........................................................................................................................................................................]
Selecting previously unselected package ocl-icd-libopencl1:amd64.........................................................................................................................................................................]
Preparing to unpack .../16-ocl-icd-libopencl1_2.2.11-1ubuntu1_amd64.deb ...
Unpacking ocl-icd-libopencl1:amd64 (2.2.11-1ubuntu1) ...
Selecting previously unselected package libhwloc-plugins:amd64.#####.....................................................................................................................................................................]
Preparing to unpack .../17-libhwloc-plugins_2.1.0+dfsg-4_amd64.deb ...
Unpacking libhwloc-plugins:amd64 (2.1.0+dfsg-4) ...##################....................................................................................................................................................................]
Selecting previously unselected package libpmix2:amd64.
Preparing to unpack .../18-libpmix2_3.1.5-1_amd64.deb ...
Unpacking libpmix2:amd64 (3.1.5-1) ...##################################.................................................................................................................................................................]
Selecting previously unselected package libopenmpi3:amd64.################...............................................................................................................................................................]
Preparing to unpack .../19-libopenmpi3_4.0.3-0ubuntu1_amd64.deb ...
Unpacking libopenmpi3:amd64 (4.0.3-0ubuntu1) ...
Selecting previously unselected package libcaf-openmpi-3:amd64.##############............................................................................................................................................................]
Preparing to unpack .../20-libcaf-openmpi-3_2.8.0-1_amd64.deb ...
Unpacking libcaf-openmpi-3:amd64 (2.8.0-1) ...################################...........................................................................................................................................................]
Selecting previously unselected package libcoarrays-dev:amd64.
Preparing to unpack .../21-libcoarrays-dev_2.8.0-1_amd64.deb ...
Unpacking libcoarrays-dev:amd64 (2.8.0-1) ...####################################........................................................................................................................................................]
Selecting previously unselected package openmpi-common.############################......................................................................................................................................................]
Preparing to unpack .../22-openmpi-common_4.0.3-0ubuntu1_all.deb ...
Unpacking openmpi-common (4.0.3-0ubuntu1) ...#######################################.....................................................................................................................................................]
Selecting previously unselected package openmpi-bin.
Preparing to unpack .../23-openmpi-bin_4.0.3-0ubuntu1_amd64.deb ...
Unpacking openmpi-bin (4.0.3-0ubuntu1) ...#############################################..................................................................................................................................................]
Selecting previously unselected package libcoarrays-openmpi-dev:amd64.###################................................................................................................................................................]
Preparing to unpack .../24-libcoarrays-openmpi-dev_2.8.0-1_amd64.deb ...
Unpacking libcoarrays-openmpi-dev:amd64 (2.8.0-1) ...
Selecting previously unselected package libevent-extra-2.1-7:amd64.#########################.............................................................................................................................................]
Preparing to unpack .../25-libevent-extra-2.1-7_2.1.11-stable-1_amd64.deb ...
Unpacking libevent-extra-2.1-7:amd64 (2.1.11-stable-1) ...###################################............................................................................................................................................]
Selecting previously unselected package libevent-openssl-2.1-7:amd64.
Preparing to unpack .../26-libevent-openssl-2.1-7_2.1.11-stable-1_amd64.deb ...
Unpacking libevent-openssl-2.1-7:amd64 (2.1.11-stable-1) ...####################################.........................................................................................................................................]
Selecting previously unselected package libevent-dev.#############################################.......................................................................................................................................]
Preparing to unpack .../27-libevent-dev_2.1.11-stable-1_amd64.deb ...
Unpacking libevent-dev (2.1.11-stable-1) ...
Selecting previously unselected package libltdl-dev:amd64.###########################################....................................................................................................................................]
Preparing to unpack .../28-libltdl-dev_2.4.6-14_amd64.deb ...
Unpacking libltdl-dev:amd64 (2.4.6-14) ...############################################################...................................................................................................................................]
Selecting previously unselected package libnl-3-dev:amd64.##############################################.................................................................................................................................]
Preparing to unpack .../29-libnl-3-dev_3.4.0-1_amd64.deb ...
Unpacking libnl-3-dev:amd64 (3.4.0-1) ...
Selecting previously unselected package libnl-route-3-dev:amd64.##########################################...............................................................................................................................]
Preparing to unpack .../30-libnl-route-3-dev_3.4.0-1_amd64.deb ...
Unpacking libnl-route-3-dev:amd64 (3.4.0-1) ...#############################################################.............................................................................................................................]
Selecting previously unselected package libtool.
Preparing to unpack .../31-libtool_2.4.6-14_all.deb ...
Unpacking libtool (2.4.6-14) ...###############################################################################..........................................................................................................................]
Selecting previously unselected package libnuma-dev:amd64.######################################################.........................................................................................................................]
Preparing to unpack .../32-libnuma-dev_2.0.12-1_amd64.deb ...
Unpacking libnuma-dev:amd64 (2.0.12-1) ...
Selecting previously unselected package libhwloc-dev:amd64.########################################################......................................................................................................................]
Preparing to unpack .../33-libhwloc-dev_2.1.0+dfsg-4_amd64.deb ...
Unpacking libhwloc-dev:amd64 (2.1.0+dfsg-4) ...######################################################################....................................................................................................................]
Selecting previously unselected package libibverbs-dev:amd64.
Preparing to unpack .../34-libibverbs-dev_28.0-1ubuntu1_amd64.deb ...
Unpacking libibverbs-dev:amd64 (28.0-1ubuntu1) ...######################################################################.................................................................................................................]
Selecting previously unselected package libopenmpi-dev:amd64.############################################################................................................................................................................]
Preparing to unpack .../35-libopenmpi-dev_4.0.3-0ubuntu1_amd64.deb ...
Unpacking libopenmpi-dev:amd64 (4.0.3-0ubuntu1) ...
Setting up libcoarrays-dev:amd64 (2.8.0-1) ...##############################################################################.............................................................................................................]
Setting up m4 (1.4.18-4) ...###################################################################################################..........................................................................................................]
Setting up libnuma-dev:amd64 (2.0.12-1) ...#######################################################################################.......................................................................................................]
Setting up libxnvctrl0:amd64 (470.57.01-0ubuntu0.20.04.3) ...#######################################################################.....................................................................................................]
Setting up autotools-dev (20180224.1) ...###############################################################################################.................................................................................................]
Setting up libhwloc15:amd64 (2.1.0+dfsg-4) ...#############################################################################################..............................................................................................]
Setting up libevent-core-2.1-7:amd64 (2.1.11-stable-1) ...###################################################################################............................................................................................]
Setting up autoconf (2.69-11.1) ...##############################################################################################################........................................................................................]
Setting up ocl-icd-libopencl1:amd64 (2.2.11-1ubuntu1) ...##########################################################################################......................................................................................]
Setting up libnl-3-200:amd64 (3.4.0-1) ...#############################################################################################################..................................................................................]
Setting up libpsm2-2 (11.2.86-1) ...######################################################################################################################...............................................................................]
Setting up openmpi-common (4.0.3-0ubuntu1) ...#############################################################################################################..............................................................................]
Setting up libpsm-infinipath1 (3.3+20.604758e7-6) ...###########################################################################################################.........................................................................]
update-alternatives: using /usr/lib/libpsm1/libpsm_infinipath.so.1.16 to provide /usr/lib/x86_64-linux-gnu/libpsm_infinipath.so.1 (libpsm_infinipath.so.1) in auto mode
Setting up libevent-pthreads-2.1-7:amd64 (2.1.11-stable-1) ...#####################################################################################################......................................................................]
Setting up automake (1:1.16.1-4ubuntu6) ...#########################################################################################################################.....................................................................]
update-alternatives: using /usr/bin/automake-1.16 to provide /usr/bin/automake (automake) in auto mode#################################################################..................................................................]
Setting up libevent-extra-2.1-7:amd64 (2.1.11-stable-1) ...##############################################################################################################................................................................]
Setting up libtool (2.4.6-14) ...#########################################################################################################################################...............................................................]
Setting up libevent-openssl-2.1-7:amd64 (2.1.11-stable-1) ...##################################################################################################################..........................................................]
Setting up libhwloc-plugins:amd64 (2.1.0+dfsg-4) ...##############################################################################################################################.......................................................]
Setting up libnl-route-3-200:amd64 (3.4.0-1) ...###################################################################################################################################......................................................]
Setting up libltdl-dev:amd64 (2.4.6-14) ...#############################################################################################################################################.................................................]
Setting up libevent-dev (2.1.11-stable-1) ...##############################################################################################################################################..............................................]
Setting up libnl-3-dev:amd64 (3.4.0-1) ...####################################################################################################################################################...........................................]
Setting up libhwloc-dev:amd64 (2.1.0+dfsg-4) ...################################################################################################################################################.........................................]
Setting up libibverbs1:amd64 (28.0-1ubuntu1) ...##################################################################################################################################################.......................................]
Setting up libpmix2:amd64 (3.1.5-1) ...###############################################################################################################################################################...................................]
Setting up ibverbs-providers:amd64 (28.0-1ubuntu1) ...###################################################################################################################################################................................]
Setting up libnl-route-3-dev:amd64 (3.4.0-1) ...###########################################################################################################################################################..............................]
Setting up librdmacm1:amd64 (28.0-1ubuntu1) ...################################################################################################################################################################..........................]
Setting up libibverbs-dev:amd64 (28.0-1ubuntu1) ...###############################################################################################################################################################.......................]
Setting up libfabric1 (1.6.2-3) ...##################################################################################################################################################################################....................]
Setting up libopenmpi3:amd64 (4.0.3-0ubuntu1) ...#######################################################################################################################################################################.................]
Setting up libcaf-openmpi-3:amd64 (2.8.0-1) ...###########################################################################################################################################################################...............]
Setting up openmpi-bin (4.0.3-0ubuntu1) ...###################################################################################################################################################################################...........]
update-alternatives: using /usr/bin/mpirun.openmpi to provide /usr/bin/mpirun (mpirun) in auto mode
update-alternatives: using /usr/bin/mpicc.openmpi to provide /usr/bin/mpicc (mpi) in auto mode
Setting up libcoarrays-openmpi-dev:amd64 (2.8.0-1) ...###########################################################################################################################################################################........]
Setting up libopenmpi-dev:amd64 (4.0.3-0ubuntu1) ...###############################################################################################################################################################################......]
update-alternatives: using /usr/lib/x86_64-linux-gnu/openmpi/include to provide /usr/include/x86_64-linux-gnu/mpi (mpi-x86_64-linux-gnu) in auto mode#################################################################################...]
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...#################################################################################################################################################################################..]
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for install-info (6.7.0.dfsg.2-5) ...

もういちどmpi4pyをインストールしてみる

mtkbirdman@DESKTOP-XXXXXXX:~$ python3.10 -m pip install mpi4py
Defaulting to user installation because normal site-packages is not writeable
Collecting mpi4py
  Using cached mpi4py-3.1.3.tar.gz (2.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mpi4py
  Building wheel for mpi4py (pyproject.toml) ... done
  Created wheel for mpi4py: filename=mpi4py-3.1.3-cp310-cp310-linux_x86_64.whl size=3368932 sha256=ca6dc53c0c5ab03b79ac0b8e173940ed5f870e6057d2d766b0b8cd36ef8805b0
  Stored in directory: /home/mtkbirdman/.cache/pip/wheels/75/c7/c1/7f61cbdfb623be299e1457cdf6b44675857b5443a569c63372
Successfully built mpi4py
Installing collected packages: mpi4py
Successfully installed mpi4py-3.1.3

できた

以上

バグレポート
質問・感想・意見などあれば気軽にTwitterのDMかコメントお願いします!
スポンサーリンク
mtk_birdman's blog

コメント