I was trying to install pyaudio following the steps:
1) sudo apt-get install python-dev
2) sudo apt-get install portaudio19-dev
3) sudo pip install pyaudio
Couldn't get through step 2.
Error message: Some packages could not be installed. This may mean that you haverequested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:
The following packages have unmet dependencies:
portaudio19-dev : Depends: libjack-dev
Depends: libportaudio2 (= 19+svn20140130-1) but 19.6.0-1 is to be installed
E: Unable to correct problems, you have held broken packages.
4 Answers 4
If your system is not "broken", you may be successful with this sequence:
1. sudo apt-get update
2. sudo apt-get upgrade
3. sudo apt-get install portaudio19-dev
4. sudo pip install pyaudio
In general: 1. updates the package list on your system, and 2. upgrades all installed packages. These two steps should usually be done before you install any new packages.
If your system still complains of broken packages and such, try this sequence:
1. sudo apt-get update
2. sudo apt-get upgrade
3. sudo apt-get dist-upgrade
4. sudo apt-get install portaudio19-dev
5. sudo pip install pyaudio
Briefly, the difference between step 2 and step 3 is this:
sudo apt-get dist-upgrade
will add & remove packages if necessary, and attempts to deal "intelligently" with changed dependencies.
sudo apt-get upgrade
under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. This may be considered "safer" than dist-upgrade
, but not as effective in all cases.
-
which means my system is broken? beside sudo apt-get update/upgrade, is there other way to update package?June Wang– June Wang2018年06月05日 02:52:15 +00:00Commented Jun 5, 2018 at 2:52
-
@JuneWang: No, not necessarily broken, and yes, there is another way. However, I am confused as to your status; please see my comment to your answer below & advise us of your status.Seamus– Seamus2018年06月05日 14:42:00 +00:00Commented Jun 5, 2018 at 14:42
-
just tried it. after running step 4, E: Unalbe to locate package portaudio19-devJune Wang– June Wang2018年06月06日 01:52:54 +00:00Commented Jun 6, 2018 at 1:52
-
How have you determined that the package
portaudio19-dev
exists? By that I mean, did you hear of this package somewhere, or have you verified that it's actually a package that's available for your system?Seamus– Seamus2018年06月06日 13:52:26 +00:00Commented Jun 6, 2018 at 13:52 -
I'm very sorry, but I'm having a problem tracking this. It seems your configuration may be "dynamic". Also I see you've put up another post in this forum that suggests you've installed another RPi distribution (MATLAB?). I wish you the best of luck. Wrt your original problem, I did find that similar problems have been reported. As a final suggestion you might try this:
sudo apt-get update --fix-missing
Seamus– Seamus2018年06月06日 16:23:29 +00:00Commented Jun 6, 2018 at 16:23
I reinstalled the system(Stretch) twice again then run the codes in the sequence again, still get the same error. Later on I ran into all kinds of ‘broken packages’ when I was trying to install pyqt, matlab, etc. Don’t know why, but for pyaudio
I was susccessful using
$ sudo apt-get install python-pyaudio
-
Sorry, I'm confused. You said, "Problem solved", and then said "still get the same error". If you're still having issues, please let is know as there is one more thing to try.Seamus– Seamus2018年06月05日 14:39:13 +00:00Commented Jun 5, 2018 at 14:39
-
I thought it was a system bug of the Stretch since ive been having all kinds of ‘broken packages’ yesterday while trying to install pyaudio and pyqt. Especially I make sure I Sudo apt-get update/upgrade everytime I try to install something new. Yes please let me know what’s the other option to try.June Wang– June Wang2018年06月05日 16:24:06 +00:00Commented Jun 5, 2018 at 16:24
-
I've edited my answer above to add a step that may solve your problem. Please let us know how this works.Seamus– Seamus2018年06月05日 18:49:46 +00:00Commented Jun 5, 2018 at 18:49
To install pyaudio in Raspberry Pi OS (for python3) use a sudo apt install python3-pyaudio
command.
After installing pyaudio; to confirm it is downloaded or not, check with a pip3 list
command.
If your PYAUDO is not installed, then try
sudo apt-get install python-pyaudio
-
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer only with a link; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed or you risk to get down votes. Please take the short Tour and visit the Help Center to get an idea how things work here.Ingo– Ingo2019年03月12日 22:54:31 +00:00Commented Mar 12, 2019 at 22:54
-
Welcome to Raspberry Pi! Please take the tour and visit the helpcenter to see how things work here. This essentially a short version of June Wang's answer. What exactly is your point?2019年03月13日 18:00:29 +00:00Commented Mar 13, 2019 at 18:00
python3
? If so you should use python3-dev and pip3