ACCarnall / bagpipes

Bagpipes is a state of the art code for generating realistic model galaxy spectra and fitting these to spectroscopic and photometric observations. Users should install with pip, not by cloning the repository.
http://bagpipes.readthedocs.io
GNU General Public License v3.0
80 stars 41 forks source link

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

Closed camipacifici closed 3 months ago

camipacifici commented 3 months ago

Hi Adam!

I am trying to use bagpipes to fit a spectrum, but I am encountering an error I cannot debug. I am using your example number 5 feeding only the VANDELS spectrum (no photometry). Let me know if this error rings a bell or you need more information from me. I am on an Apple M2 Max.

Thank you very much! Best wishes, Cami

AttributeError Traceback (most recent call last) Cell In[8], line 3 1 fit = pipes.fit(galaxy, fit_instructions, run="spectroscopy") ----> 3 fit.fit(verbose=False)

File ~/opt/miniconda3/envs/bagpipes/lib/python3.11/site-packages/bagpipes/fitting/fit.py:190, in fit.fit(self, verbose, n_live, use_MPI, sampler, n_eff, discard_exploration, n_networks, pool) 187 os.environ["PYTHONWARNINGS"] = "ignore" 189 if sampler == "multinest": --> 190 pmn.run(self.fitted_model.lnlike, 191 self.fitted_model.prior.transform, 192 self.fitted_model.ndim, n_live_points=n_live, 193 importance_nested_sampling=False, verbose=verbose, 194 sampling_efficiency="model", 195 outputfiles_basename=self.fname, use_MPI=use_MPI) 197 elif sampler == "nautilus": 198 n_sampler = Sampler(self.fitted_model.prior.transform, 199 self.fitted_model.lnlike, n_live=n_live, 200 n_networks=n_networks, pool=pool, 201 n_dim=self.fitted_model.ndim, 202 filepath=self.fname + ".h5")

File ~/opt/miniconda3/envs/bagpipes/lib/python3.11/site-packages/pymultinest/run.py:285, in run(LogLikelihood, Prior, n_dims, n_params, n_clustering_params, wrapped_params, importance_nested_sampling, multimodal, const_efficiency_mode, n_live_points, evidence_tolerance, sampling_efficiency, n_iter_before_update, null_log_evidence, max_modes, mode_tolerance, outputfiles_basename, seed, verbose, resume, context, write_output, log_zero, max_iter, init_MPI, dump_callback, use_MPI) 283 MPI.COMM_WORLD.Barrier() 284 else: --> 285 lib.run(*args_converted) 286 if not is_thread: 287 signal.signal(signal.SIGINT, prev_handler)

File ~/opt/miniconda3/envs/bagpipes/lib/python3.11/ctypes/init.py:389, in CDLL.getattr(self, name) 387 if name.startswith('') and name.endswith(''): 388 raise AttributeError(name) --> 389 func = self.getitem(name) 390 setattr(self, name, func) 391 return func

File ~/opt/miniconda3/envs/bagpipes/lib/python3.11/ctypes/init.py:394, in CDLL.getitem(self, name_or_ordinal) 393 def getitem(self, name_or_ordinal): --> 394 func = self._FuncPtr((name_or_ordinal, self)) 395 if not isinstance(name_or_ordinal, int): 396 func.name = name_or_ordinal

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

ACCarnall commented 3 months ago

Hi Cami,

I'm afraid this is a MultiNest issue and therefore well outside of my understanding. I know a lot of people have issues on the new M1,2,3 Macs though. I did a quick google and found this Stack Overflow thread, which seems to have some useful advice (in particular referencing a couple of other GitHub issues):

https://stackoverflow.com/questions/61939257/attributeerror-dlsymrtld-default-run-symbol-not-found-meaning

My ultimate recommendation if you can't fix it would be to swap over to using Nautilus, which I've been getting nice (and fast) results with recently, you can invoke this with e.g.:

fit_cat.fit(n_live=1000, verbose=True, mpi_serial=False, sampler="nautilus", pool=12)

Pool is the number of cores to use, but Nautilus doesn't use MPI so there's no need to set the code running via mpirun, just do python filename.py as normal.

camipacifici commented 3 months ago

Hi Adam, Thank you for the quick response. I am trying nautilus first and it is currently running...lets see what comes out :) I had to leave out the mpi_serial keyword. It said it did not recognize it. I'll come back here if I have other problems. Thank you again!

camipacifici commented 3 months ago

It ran!! And the fit looks sensible. Off to my spectrum now. Feel free to close this issue. I'll open a new one if I have other problems. Thank you again!

ACCarnall commented 3 months ago

Good good! Ah yes, if you're using fit rather than fit_catalogue it won't accept mpi_serial. I also haven't got round to making mpi_serial in fit_catalogue work with Nautilus yet.