henon / Python.Included

A Python.NET based framework enabling .NET libraries to call into Python packages without depending on a local Python installation.
MIT License
313 stars 51 forks source link

argument of type 'NoneType' is not iterable #49

Closed danijerez closed 1 year ago

danijerez commented 1 year ago

I was trying to do a simple test to use whisper.

On the line: dynamic whisper = Py.Import("whisper");

gives the following error: argument of type 'NoneType' is not iterable

check the version of python and it is 3.11 which is theoretically compatible

class Program
    {
        static async Task Main(string[] args)
        {
            await Installer.SetupPython();
            await Installer.TryInstallPip();
            await Installer.PipInstallModule("openai-whisper");
            PythonEngine.Initialize();
            using (Py.GIL())
            {
                dynamic whisper = Py.Import("whisper");
                var model = whisper.load_model("base");
                var result = model.transcribe("/path/to/audio/file.wav");
                Console.WriteLine(result["text"]);
            }
        }
    }

Any idea what could happen?

henon commented 1 year ago

Can you please check if this happens with plain Pythonnet too? If so, it would not be a bug of Python.Included which only supplies different deployment routines

danijerez commented 1 year ago

I have tried it directly as you have told me and the exact same thing happens.

henon commented 1 year ago

Ok, then I would suggest you post the issue on the pythonnet repo. I hope they can help you.