[Tutor] Early Coder problem

Mats Wichmann mats at wichmann.us
Sun Apr 12 08:40:35 EDT 2020


On 4/11/20 4:55 PM, Laffey, Ian wrote:
> Hi tutors! I was unaware that this service was available and just found it so let me know if there is a better format for me to ask for help.
> 
> Anyways, I have two questions. First, I was wondering why I have so many Python related folders. I think the easy answer is that I have unfortunately spread it across three drives (2 SSD and 1 HDD) but I wanted to clarify how I know where something Is pulling directories from when executing, specifically using PyCharm I am having issues with the interpreter.
> 
> Secondarily, I have tried to pip install PyAudio a dozen times this past week and each time I get an annoying, illegible error code. Can you help me figure out my issue here, also using PyCharm for this, but having same issue and error in Visual Studio.

Turns out for this problem, not only could we decode the errors, but
it's something I've been asked about elsewhere several times in the last
couple of weeks, so it's familiar.  The fault is with the PyAudio
project, not you.

tl;dr - just follow Peter's suggestion, I keep forgetting about that
really useful site of "not official builds, but really get you out of a
hole where there isn't one" Python software.

===
If you wanted some explanation, for education purposes - /guessing/ that
your crazy message has to do with Visual Studio, etc:

When the author of a Python module writes their module, they can write
it either in pure Python, or they can use the extension mechanism to
bind C/C++ language code to the Python. The latter is often done if the
module code has performance-critical aspects, although there are also
other reasons for choosing that approach. In the former case, the module
can easily be installed, in the latter, it is necessary to make sure the
binary compiled parts are present, and those are system-specific.

Of course the best way for the module author to meet that requirement is
to package up the binary pieces.

When you ask for a pip install, the pip module reaches out to the server
on pypi.org and requests a complete package (these are called "wheels"
and have a filename suffix of .whl) that meets the requirements of the
requesting system - operating system, 32 or 64-bit if applicable, Python
version.  If found, that is downloaded and installed, and you're good to
go if nothing went wrong.  If not found, the fallback source code
version (called by Python people an "sdist") is downloaded, unpacked,
and the unpacked code's "setup.py" script is executed to try to get
everything in order.

In your case, you can see this is what is happening - it is trying to
run setup.py (indicating a suitable wheel with the binary parts was not
found), and it's failing because there is no compiler present to build
the "_portaudio" extension.  On Windows this is normally the case - a
compiler is not present by default, and if present may require
specialized setup.

If you search on pypi.org for your module, and then click on "download
files", it has the helpful effect of showing you which files are
available to download - the same information pip would get.

https://pypi.org/project/PyAudio/#files

here's that listing:
PyAudio-0.2.11-cp27-cp27m-win32.whl (49.3 kB) 	Wheel 	cp27 	Mar 18, 2017
PyAudio-0.2.11-cp27-cp27m-win_amd64.whl (52.5 kB) 	Wheel 	cp27 	Mar 18, 2017
PyAudio-0.2.11-cp34-cp34m-win32.whl (49.3 kB) 	Wheel 	cp34 	Mar 18, 2017
PyAudio-0.2.11-cp34-cp34m-win_amd64.whl (52.5 kB) 	Wheel 	cp34 	Mar 18, 2017
PyAudio-0.2.11-cp35-cp35m-win32.whl (49.3 kB) 	Wheel 	cp35 	Mar 18, 2017
PyAudio-0.2.11-cp35-cp35m-win_amd64.whl (52.6 kB) 	Wheel 	cp35 	Mar 18, 2017
PyAudio-0.2.11-cp36-cp36m-win32.whl (49.3 kB) 	Wheel 	cp36 	Mar 18, 2017
PyAudio-0.2.11-cp36-cp36m-win_amd64.whl (52.6 kB) 	Wheel 	cp36 	Mar 18, 2017
PyAudio-0.2.11.tar.gz (37.4 kB) 	Source 	None 	Mar 18, 2017 	


here we can see wheels for CPython 2.7 (cp27) on windows 32-bit, and for
windows 64-bit; same for 3.4, 3.5 and 3.6, and the fallback source code
version, the .tar.gz file.

None of these are newer than March, 2017.

So the module author has not uploaded wheels for Python 3.7 or 3.8 -
that's why pip tried to fall back to building, which then failed.


More information about the Tutor mailing list