Mac mpi4py installation issue

4,267 views
Skip to first unread message

Gabriel Gassem

unread,
Feb 9, 2015, 1:25:15 PM2/9/15
to mpi...@googlegroups.com
I am using Python 2.7.5 and have installed openmpi-1.8.4. 

However when i try and build mpi4py-1.3.1 using '$ python setup.py build' in terminal as outlined in the file 'docs/source/usrman/install.rst', i get the error pasted in the text document attached. See below for the final few lines for convenience:


[...    ld: warning: ignoring file _configtest.o, file was built for i386 which is not the architecture being linked (x86_64): _configtest.o

   Undefined symbols for architecture x86_64:

      "_main", referenced from:

         implicit entry/start for main executable

    ld: symbol(s) not found for architecture x86_64

    collect2: error: ld returned 1 exit status

    failure.

    removing: _configtest.c _configtest.o

    error: Cannot link MPI programs. Check your configuration!!! ]


From my google searches i believe it has something to do with using a 64 bit computer or potentially needing to specify that I'm using openmpi rather than MPICH, etc. Freddie suggested that 'This may be because either Python/OpenMPI have been built as 32-bit applications.' Any suggestions on how to get around this or a better alternative would be greatly appreciated,

thanks in advance,

Gabriel

error_message.txt

Lisandro Dalcin

unread,
Feb 9, 2015, 2:09:50 PM2/9/15
to mpi4py
Try the following:

$ export ARCHFLAGS='-arch x86_64'
$ python setup.py build
> --
> You received this message because you are subscribed to the Google Groups
> "mpi4py" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mpi4py+un...@googlegroups.com.
> To post to this group, send email to mpi...@googlegroups.com.
> Visit this group at http://groups.google.com/group/mpi4py.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mpi4py/af8b637e-f83b-4ecc-8e89-089cec27cb56%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459

Aron Ahmadia

unread,
Feb 9, 2015, 2:13:07 PM2/9/15
to mpi...@googlegroups.com
Your OpenMPI may be built for i386, which would be annoying.  What version of OS X are you running?

Gabriel Gassem

unread,
Feb 9, 2015, 3:28:28 PM2/9/15
to mpi...@googlegroups.com
This worked, thanks a lot!

Gabriel

Gabriel Gassem

unread,
Feb 9, 2015, 3:29:42 PM2/9/15
to mpi...@googlegroups.com, ar...@ahmadia.net
Thanks for the quick reply Aron, fortunately Lisandro solved the issue.

Gabriel 

Lisandro Dalcin

unread,
Feb 10, 2015, 12:55:33 AM2/10/15
to mpi4py, Aron Ahmadia
On 9 February 2015 at 23:29, Gabriel Gassem <gga...@gmail.com> wrote:
> Thanks for the quick reply Aron, fortunately Lisandro solved the issue.
>

BTW, this is somehow documented here:
http://mpi4py.readthedocs.org/en/latest/appendix.html#mac-os-x-and-universal-sdk-python-builds

andrewth...@gmail.com

unread,
Feb 1, 2016, 9:07:41 AM2/1/16
to mpi4py, ar...@ahmadia.net
Hi,
I have had a similar issue trying to install mpi4py both using '$ pip install mpi4py' and '$ python3 setup.py install'. I am using Python 3 on a Mac, and get a similar error message as in Gabriel's post, referring to 'ld: symbol(s) not found for architecture x86_64'. Please see below for more of the error message. 

I have tried using 
$ export ARCHFLAGS='-arch x86_64' 
$ python setup.py build 

as well as the 'Alternative 1' and 'Alternative 2' commands referenced in http://mpi4py.readthedocs.org/en/latest/appendix.html#building-mpi-from-sources.
Neither of these seem to work. The issue appears to be in the installation command, rather than the build command.

Is there any other way to resolve / get around this?
Thank You
Andrew Holt

Final lines of error when using '$ pip install mpi4py':

 


    Undefined symbols for architecture x86_64:

      "_MPI_Finalize", referenced from:

          _main in _configtest.o

      "_MPI_Init", referenced from:

          _main in _configtest.o

    ld: symbol(s) not found for architecture x86_64

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    failure.

    removing: _configtest.c _configtest.o

    error: Cannot link MPI programs. Check your configuration!!!


Final lines of error when using '$ python3 setup.py install':

Undefined symbols for architecture x86_64:

  "_MPI_Finalize", referenced from:

      _main in _configtest.o

  "_MPI_Init", referenced from:

      _main in _configtest.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: Setup script exited with error: Cannot link MPI programs. Check your configuration!!!

Lisandro Dalcin

unread,
Feb 1, 2016, 9:13:32 AM2/1/16
to mpi4py, Aron Ahmadia
On 1 February 2016 at 17:01, <andrewth...@gmail.com> wrote:
> Hi,
> I have had a similar issue trying to install mpi4py both using '$ pip
> install mpi4py' and '$ python3 setup.py install'. I am using Python 3 on a
> Mac, and get a similar error message as in Gabriel's post, referring to 'ld:
> symbol(s) not found for architecture x86_64'. Please see below for more of
> the error message.

Well, it seems you have not installed MPI. If you are a Mac user, you
should really look at Homebrew, install it, and then "brew install
python mpich", then "pip install mpi4py".

andrewth...@gmail.com

unread,
Feb 1, 2016, 9:51:26 AM2/1/16
to mpi4py, ar...@ahmadia.net
Thank you for your response. Unfortunately the installation of mpi4py still isn't working. The error message  'error: Cannot link MPI programs. Check your configuration!!!' is given. Please see below for parts of the messages. The full response is in the attached file.

$ brew install python mpich


Warning: python-2.7.11 already installed, it's just not linked

Warning: mpich-3.2 already installed, it's just not linked


$ pip install mpi4py


Undefined symbols for architecture x86_64:

    "_MPI_Finalize", referenced from:

        _main in _configtest.o

    "_MPI_Init", referenced from:

        _main in _configtest.o

  ld: symbol(s) not found for architecture x86_64

  clang: error: linker command failed with exit code 1 (use -v to see invocation)

  failure.

  removing: _configtest.c _configtest.o

  error: Cannot link MPI programs. Check your configuration!!!

  

  ----------------------------------------

  Failed building wheel for mpi4py

  Running setup.py clean for mpi4py

Failed to build mpi4py

Installing collected packages: mpi4py

  Running setup.py install for mpi4py ... error



followed later by:



    Undefined symbols for architecture x86_64:

      "_MPI_Finalize", referenced from:

          _main in _configtest.o

      "_MPI_Init", referenced from:

          _main in _configtest.o

    ld: symbol(s) not found for architecture x86_64

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    failure.

    removing: _configtest.c _configtest.o

    error: Cannot link MPI programs. Check your configuration!!!

    

    ----------------------------------------

Command "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/9j/s316vxwj06qdj8yd432gj7k40000gn/T/pip-build-3a22qqzu/mpi4py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/9j/s316vxwj06qdj8yd432gj7k40000gn/T/pip-xx4ne8pm-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/9j/s316vxwj06qdj8yd432gj7k40000gn/T/pip-build-3a22qqzu/mpi4py

error.txt

Aron Ahmadia

unread,
Feb 1, 2016, 9:53:05 AM2/1/16
to mpi4py
Andrew, you need to run "brew link mpich" in order to use it by default.  The brew program explains this in the output at the end of the install.

--
You received this message because you are subscribed to the Google Groups "mpi4py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mpi4py+un...@googlegroups.com.
To post to this group, send email to mpi...@googlegroups.com.

Andrew Holt

unread,
Feb 1, 2016, 11:20:39 AM2/1/16
to mpi...@googlegroups.com
Thank you - I have resolved the issue now.
You received this message because you are subscribed to a topic in the Google Groups "mpi4py" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mpi4py/PTKq6abLpNQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mpi4py+un...@googlegroups.com.

To post to this group, send email to mpi...@googlegroups.com.
Visit this group at https://groups.google.com/group/mpi4py.
To view this discussion on the web visit https://groups.google.com/d/msgid/mpi4py/CAPhiW4hr-2bbp36aX9OBjW0GqSfM6o-ZFxEjwhVE64iC109K3w%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages