Unrecognized function or variable 'lbfgsb_wrapper'

Hello everyone,

I am currently using Osprey 2.5.0 to quantify simulated spectra for my master’s thesis. I am running it on macOS Ventura 13.2.1 with Matlab 2020b. I was trying to follow along with the tutorial using the GUI, and unfortunately ran into the following error during the “Model data” step:

Running preliminary analysis with reduced basis set...Unrecognized function or variable 'lbfgsb_wrapper'.

Error in lbfgsb (line 166)
[f,x,taskInteger,outer_count, k] = lbfgsb_wrapper( m, x, l, u, nbd, ...

Error in fit_Osprey_PrelimReduced>fit_Osprey_PrelimReduced_Model (line 299)
[ampl, ~, ~] = lbfgsb(fun, l, u, opts );

Error in fit_Osprey_PrelimReduced>@(x)fit_Osprey_PrelimReduced_Model(x,inputData,inputSettings)
(line 157)
[x] = LevenbergMarquardt(@(x) fit_Osprey_PrelimReduced_Model(x, inputData,
inputSettings),x0,lb,ub,opts);

Error in LevenbergMarquardt>@(y,vara)obj(reshape(transformback(y),size(xForm)),vara{:}) (line
159)
objy=@(y,vara)obj(reshape(transformback(y),size(xForm)),vara{:});

Error in LevenbergMarquardt>eval_fun (line 524)
[argu_out{:}]=objy(yGuess,extra_arguments);

Error in LevenbergMarquardt (line 225)
    [fval,Resnorm,J,extra_arguments]=eval_fun(objy,yGuess,Jacobian_method,extra_arguments);

Error in fit_Osprey_PrelimReduced (line 157)
[x] = LevenbergMarquardt(@(x) fit_Osprey_PrelimReduced_Model(x, inputData,
inputSettings),x0,lb,ub,opts);

Error in fit_Osprey (line 130)
        [fitParamsStep1] = fit_Osprey_PrelimReduced(dataToFitRef, resBasisSet, fitRangePPM);

Error in fit_runFit (line 39)
        [fitParams, resBasisSet] = fit_Osprey(dataToFit, basisSet, fitOpts);

Error in osp_fitUnEdited (line 73)
            [fitParams, resBasisSet] = fit_runFit(dataToFit, basisSet, fitModel, fitOpts);

Error in OspreyFit (line 56)
        [MRSCont] = osp_fitUnEdited(MRSCont);

Error in osp_onFit (line 36)
    MRSCont = OspreyFit(MRSCont);
 
Error while evaluating UIControl Callback.

I was using the jobNIfTIMRS.m as the job file and basis_ge_press30.mat file as my basis set. I was initially running Osprey on Matlab 2023b and decided to go back to an older version (2020b) to try and fix this. I am however, still stuck with the Unrecognized function or variable 'lbfgsb_wrapper' issue, and would really appreciate your help.

Best,
Basab

Hi @b_gupta,

Welcome to the forum and thanks for picking up Osprey!

I think, it is possible that macOS is blocking the lbfgsb_wrapper function, because it is a compiled C file downloaded from an unverified source. Could you check in the Privacy and Security settings of your Mac if it is blocking those files? It usually list recently blocked files/applications there.

This could potentially happen again when you are calling the coregistration and segmentation functions in Osprey, because they are usually blocked in the first instance as well.

Let me know if this resolves the issue.

Best,
Helge

Hi Helge,

Thank you for getting back to me. I changed the settings through Privacy and Security by temporarily disabling Mac GateKeeper. I have now unfortunately run into a different issue. My Matlab keeps crashing every time I try to run an Osprey analysis. It usually breaks right when I start to process the data. Any idea what could be wrong? I would be happy include the crash report Matlab generates in case that helps?

Best,
Basab