質問

私はUbuntu 12.04にMPICHを正常にインストールし、シンプルなテストCプログラムを予想通りコンパイルして実行することができます。

今度はPIPを使用してMPI4PYをインストールしようとしています。単にpip install mpi4pyを介して。私は最初にsudo apt-get build-dep python-mpi4pyを実行しました。

virtualenvを使っていますので、このMPI4Pyのインストールはsudoではなく(そしてはいけません)。

これは、通常のコンパイルスタッフのような長さのコンソール出力のセットの後にヒットしたコマンドとエラーです(必要に応じてコンソール出力の all を印刷できますが、ほとんどは考えることができます。問題がないことを示す標準コンパイラの警告です。

(local-dev)espears@espears-w:~$ pip install mpi4py
src/ext/mpi_swig.c: In function ‘SWIG_Python_AddErrorMsg’:

src/ext/mpi_swig.c:859:5: error: format not a string literal and no format arguments [-Werror=format-security]

cc1: some warnings being treated as errors

error: command '/usr/bin/mpicc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /home/espears/.virtualenvs/local-dev/bin/python -c "import setuptools, tokenize;__file__='/home/espears/.virtualenvs/local-dev/build/mpi4py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-5o6OwN-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/espears/.virtualenvs/local-dev/include/site/python2.7 failed with error code 1 in /home/espears/.virtualenvs/local-dev/build/mpi4py
Traceback (most recent call last):
  File "/home/espears/.virtualenvs/local-dev/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/espears/.virtualenvs/local-dev/local/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/home/espears/.virtualenvs/local-dev/local/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 31: ordinal not in range(128)
.

しかし、which mpiccは、/usr/bin/mpiccと上記のように、このmpiccを使用してシンプルな.cテストプログラムをコンパイルすると、正しい動作が働いています。

MPIをコンパイルするためのフラグオプションfPICを記述するリンクを見ましたが、私は単にMPIをインストールし、特にこれらのツールのネイティブのUbuntuパッケージにのみ使用されるだけで、個別のインストール手順を維持するのに役立ちました。手動でそれらを構築するため。

mpiccインストールプロセス内にmpi4pyが失敗している理由を判断する方法はずると判断できますか?

追加

コンソール出力から次のようになります。

building 'mpi4py._mpi_swig' extension

/usr/bin/mpicc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/ext/mpi_swig.c -o build/temp.linux-x86_64-2.7/src/ext/mpi_swig.o
.

コマンドラインから試してみると、次のエラーが発生します。

(local-dev)espears@espears-w:~$ /usr/bin/mpicc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/ext/mpi_swig.c -o build/temp.linux-x86_64-2.7/src/ext/mpi_swig.o
gcc: error: src/ext/mpi_swig.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
.

役に立ちましたか?

解決

パッケージ名ではなく、MPI4PYパッケージURLでPIPを指すだけで、私のシステムの何も変更なしでこれを回避することができました。

pip install https://bitbucket.org/mpi4py/mpi4py/downloads/mpi4py-1.3.1.tar.gz
.

他のヒント

OpenMPI-4.0.0を搭載したUbuntu 18.04でも同様の問題が発生しました。 OpenMPI-2.1.6の古いバージョンをインストールすることによって解決されました。

apt-get install openmpi=2.1.6
.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top