MATLAB: How to resolve Error using trainNetwork (line 140) Can’t reload ‘/Applicat​ions/MATLA​B_R2017b.a​pp/bin/mac​i64/libmwg​pu.dylib’

can't reload (mac)Deep Learning Toolbox

The script below worked yesterday, but not today after installing the Parallel Computing Toolbox!
The imageDataStore loaded fine; the Path is OK. I am using a MAC (OS Mavericks 10.9.5) with no GPU. I am using MATLAB R2017b.
>> flowerds = imageDatastore('Flowers','IncludeSubfolders',true,'LabelSource','foldernames');
>> [trainImgs,testImgs] = splitEachLabel(flowerds,0.6);
>> numClasses = numel(categories(flowerds.Labels));
>> net = alexnet;
>> prebuiltLayers = net.Layers(1:end-3);
>> layers(end-2) = fullyConnectedLayer(numClasses);
>> layers(end) = classificationLayer;
>> topts = trainingOptions('sgdm','InitialLearnRate',0.001);
>> [flowernet,info] = trainNetwork(trainImgs, layers, topts);
Error using trainNetwork (line 140)
Can't reload '/Applications/MATLAB_R2017b.app/bin/maci64/libmwgpu.dylib'
Caused by:
Can't reload '/Applications/MATLAB_R2017b.app/bin/maci64/libmwgpu.dylib'

Best Answer

Mac OS Mavericks is not supported for MATLAB R2017b, according to the following documentation pages:
The following workaround might be able to resolve the errors, but please be aware that there may be other functionalities that no longer work in an unsupported platform of a specific MATLAB release.
In the step in the code where you set the training options (the second-to-last line), please try manually/explicitly setting the "ExecutionEnvironment" to use the CPU. Here is the modified command to try:
>> topts = trainingOptions('sgdm','InitialLearnRate',0.001,'ExecutionEnvironment','cpu');