Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named '_sounddevice_data' #137

Closed
sprocket1 opened this issue May 3, 2018 · 26 comments
Closed

ModuleNotFoundError: No module named '_sounddevice_data' #137

sprocket1 opened this issue May 3, 2018 · 26 comments

Comments

@sprocket1
Copy link

Hi, I'm very new to Python and Spyder.
I'm getting this on the Spyder console, seems related to #110 but I'm not sure what to make of it.

import sounddevice as sd
Traceback (most recent call last):

File "", line 1, in
import sounddevice as sd

File "C:\Users\James\Anaconda3\lib\site-packages\sounddevice.py", line 73, in
import _sounddevice_data

ModuleNotFoundError: No module named '_sounddevice_data'

@mgeier
Copy link
Member

mgeier commented May 3, 2018

How did you install the sounddevice module?

@sprocket1
Copy link
Author

conda install -c conda-forge python-sounddevice

@sprocket1
Copy link
Author

I should add that I've done this on two separate Win7 machines, one 64bit and one 32bit. I get the same result on both.

@mgeier
Copy link
Member

mgeier commented May 3, 2018

OK, this should be fixed in #122, but I haven't made a new release since then, therefore it isn't available on conda-forge yet, either.

I'll make a release in the next few days, and hopefully soon afterwards this will also be available on conda-forge.

In the meantime, you should try to install the sounddevice module with pip, which should work fine.
Note that it is no problem to use pip within a conda environment.

If you are having troubles installing, don't hesitate to ask for help here.

@sprocket1
Copy link
Author

sprocket1 commented May 5, 2018

Thank you so much. That seems to have worked. Now the fun begins...

@mgeier
Copy link
Member

mgeier commented May 14, 2018

An automatic update on conda-forge is in progress, but there seems to be a minor problem keeping it from finishing: conda-forge/python-sounddevice-feedstock#1.
If anybody knows how to solve this, please do!

@mgeier
Copy link
Member

mgeier commented May 28, 2018

Version 0.3.11 is now on conda-forge.

@sprocket1 Can you please check if it works for you?

@74HC14
Copy link

74HC14 commented Jun 13, 2018

I've just tried running sounddevice in Spyder on macOS and got an identical issue with 0.3.11 as installed through conda-forge.

@mgeier
Copy link
Member

mgeier commented Jun 13, 2018

@74HC14 Thanks for checking this out. On macOS, there is a different problem: the dependency portaudio (https://anaconda.org/conda-forge/portaudio) doesn't seem to be available for macOS on the conda-forge channel, or is it?
Do you get an error/warning message on installation?

It seems to be available in the anaconda channel (https://anaconda.org/anaconda/portaudio), was this package installed in your case?

@74HC14
Copy link

74HC14 commented Jun 13, 2018

Ah, that looks like that was probably the problem. I've just run it through pip now without a hitch, thanks for the quick reply.

@mgeier
Copy link
Member

mgeier commented Jun 13, 2018

@74HC14 Did you check if the portaudio package from the anaconda channel gets installed in your case?

I've just created #144 for trying to load the dylib from anaconda, but I cannot test it because I don't have a Mac.
Does this work for you (by not using the dylib installed by pip)?
You can simply try to add this one line by hand: https://github.com/spatialaudio/python-sounddevice/pull/144/files

See also #122.

@74HC14
Copy link

74HC14 commented Jun 13, 2018

Just uninstalled sounddevice by pip and reinstalled via conda install -c conda-forge python-sounddevice. Running conda list has rows of both
portaudio 19.6.0 h41429eb_1
along with the
python-sounddevice 0.3.11 py_0 conda-forge
and I still get the error.

Portaudio is still present after uninstalling the conda sounddevice.

@mgeier
Copy link
Member

mgeier commented Jun 13, 2018

@74HC14 Thanks for testing! So the portaudio package seems to get installed automatically, even though it doesn't exist (for macOS) in the conda-forge channel. Or did you install the portaudio package before?

It is still not expected to work unless you apply the one-line change from #144!

@74HC14
Copy link

74HC14 commented Jun 13, 2018

Going back through terminal's history doesn't come up with any installs of portaudio so I'm pretty sure it was already in there, presumably bundled with Anaconda's default modules.

@mgeier
Copy link
Member

mgeier commented Jun 22, 2018

@74HC14 Did you try if the change from #144 works for you?

To determine which file was actually loaded, please provide the value of sounddevice._libname.

@sprocket1
Copy link
Author

sprocket1 commented Jul 24, 2018 via email

@mgeier
Copy link
Member

mgeier commented Jul 26, 2018

@sprocket1 Is there an error message?

@sprocket1
Copy link
Author

sprocket1 commented Jul 26, 2018 via email

@mgeier
Copy link
Member

mgeier commented Jul 27, 2018

@sprocket1 As you mentioned yourself (#137 (comment)), this is the command to install it:

conda install -c conda-forge python-sounddevice

@sprocket1
Copy link
Author

sprocket1 commented Jul 27, 2018 via email

@mgeier
Copy link
Member

mgeier commented Jul 28, 2018

@sprocket1 I'm glad that it works now for you! And thanks for the praise!

I'm sorry, but I have no experience with any of the Python-bundling-tools and I don't know anyone who has.
The only related discussion here was #130.

If you find out any ways how to make the sounddevice module work better with those tools, please let me know!

@sprocket1
Copy link
Author

sprocket1 commented Jul 28, 2018 via email

@mgeier
Copy link
Member

mgeier commented Jul 28, 2018

OK, thanks for the information.
I'm closing this issue, but feel free to add further information if you find out something new!

@regallasandeepkumarreddy

import sounddevice
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\sounddevice.py", line 71, in
raise OSError('PortAudio library not found')
OSError: PortAudio library not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "C:\Python38\lib\site-packages\sounddevice.py", line 80, in
import _sounddevice_data
ModuleNotFoundError: No module named '_sounddevice_data'

still facing the issue - tried pip install sounddevice

@DeepanshuXio
Copy link

I am also facing the exact same issue. Tried above answers but still No Luck.
raise OSError('PortAudio library not found')
OSError: PortAudio library not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/deepanshumehta/Desktop/QEAutomation/APP_Automation/conftest.py", line 3, in
from APP_Automation.utils.allutils import *
File "/Users/deepanshumehta/Desktop/QEAutomation/APP_Automation/utils/allutils.py", line 22, in
import sounddevice as sd
File "/Users/deepanshumehta/.pyenv/versions/appium/lib/python3.9/site-packages/sounddevice.py", line 80, in
import _sounddevice_data
ModuleNotFoundError: No module named '_sounddevice_data'

@mgeier
Copy link
Member

mgeier commented Jan 20, 2024

If there are still problems, please create a new issue providing the information mentioned in https://python-sounddevice.readthedocs.io/en/0.4.6/CONTRIBUTING.html#reporting-problems

And please mention what exactly you tried and what exactly happened. Simply saying "Tried above answers but still No Luck" doesn't really help. Be more specific!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants