I'm trying to run an image processing Python script from Visual Studio C# using CFFI.
I have compiled the Python script feature-extraction.py
into the DLL feature-extraction.dll
, which I wrap into C# code via P/Invoke:
[DllImport(@"..\..\feature-extraction.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void GetFeatures(
[MarshalAs(UnmanagedType.LPStr)] string path,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] string[] featureNames,
[In, Out] float[] featureValues);
When calling GetFeatures(path, names, values)
, I get the following error:
I reinstalled scikit-image
and scipy
(pip install scikit-image
, pip install scipy
), and also added the Pythonwin and Python's win32\lib folders to PATH, but I still have this issue.
I tried pip install blas
, pip install _fblas
, but it says No matching distribution for blas
.
How can I resolve this issue? Is there a specific blas
package that I need to install, in addition to scipy
?
Thanks in advance!
LE: I can run feature-extraction.py
successfully from anaconda3 prompt, which makes me think there is some issue with the runtime environment when running from C#
It worked after I reinstalled SciPy
from sources using the instructions in https://scipy.github.io/devdocs/building/windows.html. Turns out, I had to first install OpenBLAS
, and then Scipy
.