2

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.
asked Jun 5, 2018 at 1:27
3
  • Are you actually trying to use python3? If so you should use python3-dev and pip3 Commented Jun 5, 2018 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’. Commented Jun 5, 2018 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. Commented Jun 5, 2018 at 23:51

4 Answers 4

8

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.

answered Jun 5, 2018 at 2:43
6
  • which means my system is broken? beside sudo apt-get update/upgrade, is there other way to update package? Commented 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. Commented Jun 5, 2018 at 14:42
  • just tried it. after running step 4, E: Unalbe to locate package portaudio19-dev Commented 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? Commented 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 Commented Jun 6, 2018 at 16:23
1

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
answered Jun 5, 2018 at 4:05
3
  • 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. Commented 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. Commented 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. Commented Jun 5, 2018 at 18:49
1

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.

Dougie
5,38111 gold badges22 silver badges30 bronze badges
answered Feb 23, 2021 at 5:19
-1

If your PYAUDO is not installed, then try

sudo apt-get install python-pyaudio
RalfFriedl
2,1802 gold badges12 silver badges12 bronze badges
answered Mar 12, 2019 at 17:35
2
  • 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. Commented 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? Commented Mar 13, 2019 at 18:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.