PolyChord / PolyChordLite

Public version of PolyChord: See polychord.co.uk for PolyChordPro
https://polychord.io/
Other
83 stars 26 forks source link

Error: `GLIBCXX_3.4.21' not found #28

Closed ivandebono closed 4 years ago

ivandebono commented 4 years ago

There are multiple issues here, so I'll describe them all. Hopefully it will help other users.

I got the error below when I tried to install pypolychord with Python 2.7.3.

[idebono@cca007 PolyChordLite]$ make pypolychord
=======================================================================================
 now run:

    CC=mpiicc CXX=mpiicpc python setup.py install --user
[idebono@cca007 PolyChordLite]$  CC=mpiicc CXX=mpiicpc python setup.py install --user
Traceback (most recent call last):
  File "setup.py", line 3, in <module>
    import numpy
  File "/pbs/software/centos-7-x86_64/python/2.7.3/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/pbs/software/centos-7-x86_64/python/2.7.3/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/pbs/software/centos-7-x86_64/python/2.7.3/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/pbs/software/centos-7-x86_64/python/2.7.3/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/pbs/software/centos-7-x86_64/python/2.7.3/lib/python2.7/site-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: /pbs/software/centos-7-x86_64/python/2.7.3/lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS2_FromObject

The installation works perfectly well with Python 2.7.15.

But I'm getting an error when I try to import the module:

Python 2.7.15 (default, Jun  4 2018, 20:55:26)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pypolychord
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/sps/euclid/Users/idebono/.local/lib/python2.7/site-packages/pypolychord-1.16-py2.7-linux-x86_64.egg/pypolychord/__init__.py", line 28, in <module>
    raise e
ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /sps/euclid/Users/idebono/.local/lib/python2.7/site-packages/pypolychord-1.16-py2.7-linux-x86_64.egg/_pypolychord.so)

So it seems GLIBCXX_3.4.21 is required. The problem is that the latest version of GLIBCXX available (I'm working on the CC-in2p3 cluster) is GLIBCXX_3.4.19. Is there any way to make pypolychord work with the earlier version?

ivandebono commented 4 years ago

I solved this problem (after countless rounds of trial and error).

The required GLIBCXX_3.4.21 is included in the Anaconda libraries. Anaconda is available on the CC-in2p3 computing cluster, so the solution was:

  1. Run $ ccenv anaconda
  2. Install PolychordLite and pypolychord in the usual way: $make && $make pypolychord && $python setup.py install --user
  3. Done. Now I can run the test file $ python run_pypolychord.py

I hope this is helpful to other users.

williamjameshandley commented 4 years ago

Many thanks @ivandebono .

ivandebono commented 4 years ago

You're welcome, @williamjameshandley.

The earlier versions of PolychordLite (up to the previous version, in fact) worked straight out of the box, so I was wondering whether you've changed your Python distribution, perhaps to Anaconda.

williamjameshandley commented 4 years ago

I don't think there have been any changes to the python implementation recently on PolyChord's side. Are you saying that if you do a fresh install in a virtualenv for previous versions it works, but for the newest version (again a fresh install) it doesn't? I think things can play up with anaconda on upgrading from an existing install, due to the compiled components of the package.