1

I am trying to import the sounddevice module in python, but whenever I am doing that it seems to crash? I have tried older versions of sounddevice, but still the same issue. I am running Python 3.7.5. This is what the log looks like:

C:\>python
Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sounddevice

C:\>

Has anybody experienced this before?

Thanks!

Michael L
  • 163
  • 1
  • 1
  • 8
  • i just tried and it works fine, no crash !!! tell about your system it is 86x or 64xbit ? and which python installer you used? – Mayur Satav Jun 20 '20 at 17:57
  • @MayurSatav I am running 64bit Windows 10, and used the python installer from python. Module was installed via pip – Michael L Jun 20 '20 at 18:24
  • Could you please try running it in a debugger (line by line) to find out which line causes the crash? – Matthias Jun 21 '20 at 08:52
  • @Matthias I tried doing the same with PyCharm and I got this `Process finished with exit code -1073741786 (0xC0000026)` Nothing more – Michael L Jun 21 '20 at 10:30
  • Could you please try running it in PyCharm's debugger (line by line) to find out which line causes the crash? – Matthias Jun 21 '20 at 14:01
  • @Matthias I did that, but got the same output – Michael L Jun 22 '20 at 20:20
  • At which line did the crash occur? – Matthias Jun 23 '20 at 08:04
  • @Matthias I am just getting the same `Process finished with exit code -1073741786 (0xC0000026)` Here is a video demo, maybe I am doing it incorrectly? [debug video](https://www.youtube.com/watch?v=jwJX1mIhxqA) – Michael L Jun 23 '20 at 14:16
  • I guess you should set a breakpoint before starting the debugger? Then you should be able to step through the code from there. – Matthias Jun 23 '20 at 18:24

2 Answers2

0

I had this problem as well. Rather strangely it resolved itself after I installed pyaudio. They both rely on portaudio underneath and I wonder if something is missing in sounddevice's package. Sounddevice continued to work even after I uninstalled pyaudio. You might need to install pyaudio from this well respected repository: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio You need to make sure you get the file with cp37 since that is for python 3.7 You would navigate to the correct folder and do pip install filename

rfii
  • 562
  • 3
  • 14
  • Hi, thanks for the reply. I did try this, but it was still the same issue. :( – Michael L Jun 20 '20 at 19:36
  • Sorry it didn't work out. If you find another solution, I would be happy to know as well. It is a good question. Maybe if you ran the program another way, perhaps an IDE, then there would be a bigger error message for us to look at. – rfii Jun 21 '20 at 03:33
  • I tried the same with PyCharm and got this. `Process finished with exit code -1073741786 (0xC0000026)` Nothing more! – Michael L Jun 21 '20 at 10:28
0

I also have been running into this issue lately. Simply running "import sounddevice" would crash Python. Downgrading sounddevice to 0.3.8 fixed this issue for me.

If I attach a debugger, the crash reports

Unhandled exception at 0x00007FFDBD20CB98 (InProcessClient64.dll) in python.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.

>   InProcessClient64.dll!00007ffdbd20cb98()    Unknown
    InProcessClient64.dll!00007ffdbd20cb2d()    Unknown
    InProcessClient64.dll!00007ffdbd20cb49()    Unknown
    InProcessClient64.dll!00007ffdbd2128b2()    Unknown
    InProcessClient64.dll!00007ffdbd1b705b()    Unknown
    InProcessClient64.dll!00007ffdbd17bf89()    Unknown
    InProcessClient64.dll!00007ffdbd1a6a29()    Unknown
    InProcessClient64.dll!00007ffdbd17bea8()    Unknown
    _cffi_backend.cp36-win_amd64.pyd!00007ffd8d860258() Unknown
    _cffi_backend.cp36-win_amd64.pyd!PyInit__cffi_backend() + 6948 bytes    Unknown
    python36.dll!_PyCFunction_FastCallDict() + 386 bytes    Unknown
    python36.dll!PyObject_CallFunctionObjArgs() + 899 bytes Unknown
    python36.dll!_PyEval_EvalFrameDefault() + 969 bytes Unknown
    python36.dll!_Py_CheckFunctionResult() + 779 bytes  Unknown
    python36.dll!PyOS_FSPath() + 565 bytes  Unknown
    python36.dll!PyOS_FSPath() + 279 bytes  Unknown
    python36.dll!_PyEval_EvalFrameDefault() + 13746 bytes   Unknown
    python36.dll!_Py_CheckFunctionResult() + 779 bytes  Unknown
    python36.dll!PyObject_CallFunctionObjArgs() + 2031 bytes    Unknown
    python36.dll!_PyEval_EvalFrameDefault() + 969 bytes Unknown
    python36.dll!PyObject_CallFunctionObjArgs() + 1374 bytes    Unknown
    python36.dll!_PyEval_EvalFrameDefault() + 969 bytes Unknown
    python36.dll!PyObject_CallFunctionObjArgs() + 1374 bytes    Unknown
    python36.dll!_PyEval_EvalFrameDefault() + 969 bytes Unknown
    python36.dll!PyObject_CallFunctionObjArgs() + 1374 bytes    Unknown
    python36.dll!_PyEval_EvalFrameDefault() + 969 bytes Unknown
    python36.dll!_PyFunction_FastCallDict() + 218 bytes Unknown
    python36.dll!_PyObject_FastCallDict() + 321 bytes   Unknown
    python36.dll!_PyObject_CallMethodIdObjArgs() + 176 bytes    Unknown
    python36.dll!PyImport_ImportModuleLevelObject() + 529 bytes Unknown
    python36.dll!_PyEval_EvalFrameDefault() + 12700 bytes   Unknown
    python36.dll!_Py_CheckFunctionResult() + 779 bytes  Unknown
    python36.dll!PyEval_EvalCodeEx() + 155 bytes    Unknown
    python36.dll!PyEval_EvalCode() + 45 bytes   Unknown
    python36.dll!PyArena_Free() + 167 bytes Unknown
    python36.dll!PyRun_InteractiveOneObject() + 715 bytes   Unknown
    python36.dll!PyRun_InteractiveLoopFlags() + 240 bytes   Unknown
    python36.dll!PyRun_AnyFileExFlags() + 69 bytes  Unknown
    python36.dll!00000000537caf44() Unknown
    python36.dll!000000005374e57a() Unknown
    python.exe!000000001c1a126d()   Unknown
    kernel32.dll!BaseThreadInitThunk() + 20 bytes   Unknown
    ntdll.dll!RtlUserThreadStart() + 33 bytes   Unknown

I haven't been able to determine why this occurs, but downgrading sounddevice has fixed it. For me personally, sounddevice 0.3.8 is the last one that works

C:\>python -m pip install sounddevice==
ERROR: Could not find a version that satisfies the requirement sounddevice== (from versions: 0.1.0, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.3.9, 0.3.10, 0.3.11, 0.3.12, 0.3.13, 0.3.14, 0.3.15, 0.4.0)
ERROR: No matching distribution found for sounddevice==

C:\>python -m pip install sounddevice==0.4.0
Collecting sounddevice==0.4.0
Installing collected packages: sounddevice
Successfully installed sounddevice-0.4.0

C:\>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sounddevice

C:\>python -m pip install sounddevice==0.3.9
Collecting sounddevice==0.3.9
Installing collected packages: sounddevice
  Attempting uninstall: sounddevice
    Found existing installation: sounddevice 0.4.0
    Uninstalling sounddevice-0.4.0:
      Successfully uninstalled sounddevice-0.4.0
Successfully installed sounddevice-0.3.9

C:\>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sounddevice

C:\>python -m pip install sounddevice==0.3.8
Collecting sounddevice==0.3.8
Installing collected packages: sounddevice
  Attempting uninstall: sounddevice
    Found existing installation: sounddevice 0.3.9
    Uninstalling sounddevice-0.3.9:
      Successfully uninstalled sounddevice-0.3.9
Successfully installed sounddevice-0.3.8

C:\>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sounddevice
>>> exit()

C:\>
Chris O'Bryan
  • 496
  • 6
  • 9