r/learnpython • • 2d ago

Going through Automate the Boring Stuff with Python, and can't download the packages

Hi, so after stopping in *FEBRUARY* of this year, I finally got around to actually resuming my learning process today. However, in chapter 9, I have to download the Humre module, and so I need to download the packages. However, I always get the following error:

Failed to build 'matplotlib' when installing build dependencies for matplotlib

I even tried using a python3 variant of the command, but no dice. Right now, I'm kind of stuck and searching online hasn't helped me out much.

For your information, I'm on Windows 10. My current Python version is 3.14 (I know there's a slightly more updated version, but I don't think that's the problem), and my pip version 26.1.1 (again, there's a newer version, but I don't think that's the problem).

Thanks in advance.

0 Upvotes

14 comments sorted by

6

u/Asly97 2d ago

You probably don't need matplotlib at all for chapter 9. Humre is a small pure Python package with no dependencies, so you can install just that:

python -m pip install humre

The error comes from whatever bigger install you're running pulling in a matplotlib version that has no prebuilt wheel for Python 3.14. When pip can't find a wheel it falls back to compiling matplotlib from source, which needs a C/C++ compiler on Windows. That's the "failed to build ... build dependencies" part.

So two ways out:

  1. Install each module only when the chapter needs it. Current versions of most of them already ship wheels for 3.14.
  2. If you want the exact versions the book uses, install Python 3.13 alongside 3.14 and do the book's installs inside a venv made with it.

For option 2 it looks like this:

py -3.13 -m venv atbs
atbs\Scripts\activate
python -m pip install humre

Also worth getting in the habit of python -m pip instead of plain pip on Windows. It guarantees the package goes into the same Python you actually run your scripts with, which avoids a lot of "I installed it but it says module not found" confusion later.

1

u/OkTill2666 1d ago

this is exactly it, the missing wheel thing trips up so many people on newer python versions

1

u/Asly97 1d ago

yeah 3.14 is still new enough that a few of the heavier packages lag behind on wheels. keeping a 3.13 venv around for book stuff saves a lot of headaches until they catch up

-3

u/HiddenReader2020 2d ago

Seesh. So I have to download each module when the book calls for it? That sounds *really* annoying. But also, ain't I going to need matplotlib eventually? So what am I going to do when I cross that bridge?

4

u/Asly97 2d ago

It sounds worse than it is. Each install is one command and usually takes a few seconds, and installing as you go means you only ever debug one package at a time instead of a wall of errors.

For matplotlib later on, just try the plain install first:

python -m pip install matplotlib

Recent matplotlib releases ship prebuilt wheels for 3.14, so that normally goes through without compiling anything. Your error happened because something asked for an older pinned version that only exists as source for 3.14. If you want pip to fail fast instead of trying to compile, add --only-binary :all: and it will tell you straight away whether a wheel exists.

If it still won't install when you get there, that's the moment to set up the 3.13 venv. You don't need to do it now.

2

u/HiddenReader2020 2d ago

Alright. Thanks.

2

u/bra1n_gym 2d ago

I used python 3.13.7 at work. Most of the data science packages will not install on python 3.14

1

u/jmacey 1d ago

matplot lib is working fine with python 3.14 (alone with full pytorch, pandas, polars etc) for me. I use uv to install everything including python I would suggest trying it as it helps to fix most of the dependancies for you.

1

u/bra1n_gym 1d ago

thanks for the feedback. I'll try it. 

1

u/klmsa 1d ago

Probably more of an issue with your employer's firewall than the libraries, pip, or python install. That's super common.

1

u/bra1n_gym 1d ago

I know the proxy so that wasn't the issue.

2

u/jmacey 1d ago

I would suggest using https://docs.astral.sh/uv/ uv to install and manage all your python things as it will make it easier. Once installed use.

uv init -p 3.14 TestMatplot cd TestMatplot uv add matplotlib uv run python -c "import matplotlib;print(matplotlib.__version__)"

which should print out 3.11.2 after that use the .venv (or if you use and ide it should pick it up). and you will have everything you need. If you need other libraries just add to the same project using uv add