BARON - ERROR: IOError: could not spawn

I am solving a non-linear optimization problem using BARON. The BARON.jl package version I am using is 0.6.2 and it seems to be working fine. But after I update the package to 0.6.3 or 0.6.4, following error is displayed:

ERROR: IOError: could not spawn `Caroaron.exe 'C:\Users\Dell\AppData\Local\Temp\jl_ldhYWv\'`: no such file or directory (ENOENT)

Any suggestions on how to resolve this error?

The path to the BARON executable seems garbled (Caroaron.exe). Can you rebuild the BARON package and check that the contents of deps/path.jl make sense? You will need to have set the BARON_EXEC environment variable.

1 Like

I rebuild the package and the content of deps/path.jl is const baron_exec = "C:\baron\baron.exe"
BARON_EXEC environment variable is also set as follows:

Same error pops even after rebuilding the package.

You probably want C:\\baron\\baron.exe or C:/baron/baron.exe.

1 Like

Oops, looks like this is my fault:, with write it only writes the single slash

C:\\baron\\baron.exe or C:/baron/baron.exe indeed works. Thank you @odow and @joehuchette!

Hi Eric,

Is this the reason why C:\baron\baron.exe was working perfectly uptil now? Also, my environment variables for some other packages (e.g. CPLEX) are set using ‘\’ and they seems to be working perfectly fine. (I am on a windows machine).

Maybe you were on an older version of Baron.jl? The change is fairly recent. The problem isn’t the environmental variables, it’s that they get written to a file in a way that messes up the slashes on Windows. I submitted a PR to fix it, so it should get fixed in the library soon (, but just adding the / to the deps/path.jl file should work too.

(edit: at least I think so! not totally confident with how the paths work on Windows…)

1 Like

Got it! Thanks :+1:

1 Like

The latest tagged version should have a fix, if you want to give it an update.

1 Like

Thank you for the quick fix!