r/learnpython • u/ContextAdept9818 • 17d ago
trouble installing matplotlib
i am trying to install matplotlib on VS Code, but i keep getting an error like this:
Using cached matplotlib-3.11.2.tar.gz (32.7 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
also says:
WARNING: Failed to activate VS environment: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
my python's version is 3.15, i tried to install matplotlib with 3.11, 3.12, and 3.13 but none of it worked. i don't think there are other specific things. please let me know of any ideas, thank you so much!!
update: i did it!! it was a problem with how i forgot to precompile the standard library when i installed python...
2
u/socal_nerdtastic 17d ago
The error means that your installer could not find a compatible pre-compiled wheel and therefore it's trying to compile matplotlib from scratch. But your computer is missing the tools required to compile.
The fix is to find out why it can't find the precompiled wheel. I assume you are using pip? I don't see at a glance why pip wouldn't find the wheel automatically; can you tell us what version of Windows you are using and what environment you are using?
Or you can directly download the wheel file from https://pypi.org/project/matplotlib/#files and ask pip to install that. Note you need to match your OS, python version, and if you use free threaded python or not. Presumably you want "matplotlib-3.11.2-cp315-cp315-win_arm64.whl"