1

Hi I want to load my h5 model in C# using visual studio code, to load this model I'm using keras.net, my code looks like below.

var model = Keras.Models.Sequential.LoadModel("my_model.h5");
var result = model.Predict(data);
Console.WriteLine(result);

but I got is error message like this

Exception thrown: 'System.DllNotFoundException' in mscorlib.dll An unhandled exception of type 'System.DllNotFoundException' occurred in mscorlib.dll Unable to load DLL 'python38': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

does anyone know how to fix this? thank you

spaleet
  • 838
  • 2
  • 10
  • 23
  • 1
    The error is clear enough. You dont have Python 3.8 installed OR you have it but it is not set in the PATH variable. The mscorlib.dll is one of the fundamental components in .Net framework, it attempted to load python module and failed with an exception. Thats where third line of exception comes from. – Amogh Sarpotdar Jul 04 '22 at 14:42
  • I already set up my python path in environment but the error still exist. and for the The mscorlib.dll does I need to install first? – Tobias Nagata Jul 04 '22 at 15:06
  • Read here: https://stackoverflow.com/questions/9003072/unable-to-load-dll-module-could-not-be-found-hresult-0x8007007e – Dr. Snoopy Jul 04 '22 at 15:13
  • That is correct @Tobias Nagata. But the fact that the exception 'System.DllNotFoundException' was thrown from inside the mscorlib.dll was thrown tells me that your code executed correctly, went into .net runtime (thats where mscorlib.dll lives) and there it tried to call phython38 and failed - which is the last line of your error. – Amogh Sarpotdar Jul 04 '22 at 15:13
  • I've tried some suggestions to solve this problem but didn't get the solution, can you tell me what should I do to solve this problem? thanks – Tobias Nagata Jul 05 '22 at 03:11

0 Answers0