I am trying to use the MATLAB package, which I have read has a bug with both the R2022a and R2022b Matlab versions. I have R2021b installed, but when I attempt to build the package, it returns an error because it recognizes the copy of R2022b. On my other device, where I only have R2021b installed, it works fine. I still use Matlab for other purposes, so I need to keep a copy of the most recent version for that. Is there a way I can tell Julia to “look past” the R2022b copy of Matlab and find the R2021b copy? Or must I uninstall R2022b to make this work?
Thank you! This worked in the sense that it now recognized R2021b, but I am now getting another error. It says LoadError: could not load library “/Applications/MATLAB_R2021b.app/bin/maci64/libmx”
dlopen(/Applications/MATLAB_R2021b.app/bin/maci64/lixmx.dylib, 1): no suitable image found.
It means that the path to the library file that it thinks should be there /Applications/MATLAB_R2021b.app/bin/maci64/lixmx.dylib
is not actually there. It don’t have MATLAB installed, so not sure why this is the case, but you can check whether you can follow the path in the Finder or Terminal to find out where it’s different.
I apologize, please bare with me. I am not very good with computer-related stuff. The idea of “path” is new to me from installing Julia. It took me forever to simply add Julia to the executable path because I don’t know anything about it.
How would I “follow the path” to see what is in Finder or Terminal? Also, what should I expect to add in order to make it work? Would I already have the needed file installed? I should mention that Matlab is working fine on my computer.
When you run a command from the terminal, the operating system doesn’t automatically know where the program is located in the file system. It has a list of directories where it can look. If it’s not in one of those, you get an error (command not found or something). So if you install a new program (like Julia or Python or something) you have to add it to this list of directories (or PATH) so that the OS can find it.
If you search for how to change your PATH on macOS, there are a quite a few articles. Here are a couple articles I found with more details:
I’m afraid the problem is way more complicated than a simple path adjustment. We had lots of problems like this with GMT MEX toolbox. The problem is that Mathworks shipped very old versions of some common used shared libs (netCXDF for example) and then they conflicted with those of the programs calling the Matlab libs. I’m not saying that’s what is happening here but hell smells a lot like it. The only way that I know of to track this is to use otool -L called on the program that has Matlab libs dependencies and see what comes out.
Yes, I was able to replace the path. It now finds R2021b. For what it’s worth, I have deleted R2022b entirely as I can run everything I need to at the moment on R2021b. The issue remains. I did this that way we don’t have to worry about the other version potentially causing any issue.
I mentioned in a reply to a different comment that I believe this is a Mac-only issue. On my Windows laptop with only R2021b installed, I had no issues using MATLAB.jl. Everything worked as intended with no need to change anything. I’m not sure if that helps, but it’s either an issue with the way OSX reads Matlab or an issue with the Mac version of MATLAB itself.
Perhaps this is the case, but I really don’t think it is. I had no issues using MATLAB.jl on my laptop, which only had R2021b installed. Now, out of curiosity, I have deleted R2022b from my current desktop that I hope to use, and the issue persisted. My laptop is Windows and my desktop is a Mac. If it was an issue of Matlab including old files, then the Windows version should have also had the same problem. Unless the Windows version of Matlab is more refined and doesn’t have the problem? I think this is somehow a Mac issue, but I’m so bad with computers in general that I can safely say I don’t have the capability to figure it out.