1

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.
  • Are you actually trying to use python3? If so you should use python3-dev and pip3 – Milliways Jun 5 '18 at 3:49
  • I wasn’t trying to use python3. However later on I got another error message when I tried to install pyqt, it was asking me to install python3.5, then I ran into the exactly same error shown above-‘broken packages’. – June Wang Jun 5 '18 at 16:21
  • You should not use python-3 tag - this just wastes the time of those trying to help. DO NOT try to install python3.5 - it is already installed. – Milliways Jun 5 '18 at 23:51
3

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 Jun 5 '18 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 Jun 5 '18 at 14:42
  • just tried it. after running step 4, E: Unalbe to locate package portaudio19-dev – June Wang Jun 6 '18 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 Jun 6 '18 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 Jun 6 '18 at 16:23
0

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 Jun 5 '18 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 Jun 5 '18 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 Jun 5 '18 at 18:49
-1

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 Mar 12 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? – Ghanima Mar 13 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.