JohannesBuchner / PyMultiNest

Pythonic Bayesian inference and visualization for the MultiNest Nested Sampling Algorithm and PyCuba's cubature algorithms.
http://johannesbuchner.github.io/PyMultiNest/
Other
197 stars 89 forks source link

MultiNest: cmake command - gcc and g++ problem with macOS #251

Open FabiolaCocchiararo opened 8 months ago

FabiolaCocchiararo commented 8 months ago

Hi,

I have a problem with MultiNest with macOS Sonoma 14.2.1, chip Apple M1 Pro. I have installed bagpipes but I get this error:

 File ~/anaconda3/lib/python3.11/site-packages/bagpipes/fitting/fit.py:149 in fit
    pmn.run(self.fitted_model.lnlike,

  File ~/anaconda3/lib/python3.11/site-packages/pymultinest-2.12-py3.11.egg/pymultinest/run.py:285 in run
    lib.run(*args_converted)

  File ~/anaconda3/lib/python3.11/ctypes/__init__.py:389 in __getattr__
    func = self.__getitem__(name)

  File ~/anaconda3/lib/python3.11/ctypes/__init__.py:394 in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))

 AttributeError: dlsym(RTLD_DEFAULT, run): symbol not found

I have followed the guide https://johannesbuchner.github.io/PyMultiNest/install.html to install PyMultiNest and MultiNest but I have some issues with the cmake command. As reported in the guide, I tried

cmake -DCMAKE_C_COMPILER=/usr/local/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/g++ -DCMAKE_PREFIX_PATH=/usr/lib .. but I have this error:

CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_C_COMPILER:

    /usr/local/bin/gcc

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_CXX_COMPILER:

    /usr/local/bin/g++

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

I am sure that both the path for gcc and g++ are correct, because I find them with the which command.

I also tried:

export CXX=/usr/bin/g++
export CC=/usr/bin/gcc
cmake -DCMAKE_PREFIX_PATH=/usr/lib .. 

but I got the same error.

Just to see what happened, I tried

export CC=clang                      
export CXX=clang++
cmake -DCMAKE_PREFIX_PATH=/usr/lib ..

and in this case it works, but with the following step make, I get this new error:

ld: warning: ignoring duplicate libraries: '-lm'
ld: multiple errors: duplicate LC_RPATH '/opt/local/lib/libgcc' in '/opt/local/lib/openmpi-mp/libmpi_usempif08.40.dylib'; duplicate LC_RPATH '/opt/local/lib/libgcc' in '/opt/local/lib/openmpi-mp/libmpi_usempi_ignore_tkr.40.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/Users/fabiolacocchiararo/MultiNest/bin/eggboxC] Error 1
make[1]: *** [src/example_eggbox_C/CMakeFiles/eggboxC.dir/all] Error 2
make: *** [all] Error 2

I tried to modify the bash_profile file as suggested here https://github.com/JohannesBuchner/PyMultiNest/issues/214 but I got the same error.

Am I missing something?

Thank you for your support, Fabiola

sahiljhawar commented 7 months ago

@FabiolaCocchiararo Can you try the instructions given here: https://nuclear-multimessenger-astronomy.github.io/nmma/

In past we faced a lot of errors while trying to install MultiNest and PMN on arm based Macs, hence we compiled all the steps and mentioned here.

sahiljhawar commented 4 months ago

@FabiolaCocchiararo Were you able to resolve AttributeError: dlsym(RTLD_DEFAULT, run): symbol not found issue? If yes, can you share the details?

ColbyMalcolm commented 1 week ago

@FabiolaCocchiararo wondering if you ever found a solution, I'm currently having the exact same issue...