Compiler setup
Toolchain setup for scientific Python
Some scientific Python packages, especially those with compiled extensions, need a working C/C++ toolchain. Install the compiler tools for your operating system before building packages. Skip this page if you only install pre-built wheels and never compile extensions.
macOS
Install Xcode Command Line Tools, or the full Xcode developer environment from Apple:
xcode-select --install
Linux
On Ubuntu or Debian-based systems, install the base build tools:
sudo apt update
sudo apt install build-essential
Windows
Use WSL 2 with Ubuntu or another supported Linux distribution, then install the Linux build tools inside the WSL terminal. See the WSL installation guide.
sudo apt update
sudo apt install build-essential
Why this matters
- Some Python packages compile native code for speed or numerical performance.
- Compilers are often required for data analysis and scientific computing libraries.
- Installing the toolchain early avoids later build errors.
Choosing uv instead of Conda? Continue to uv setup after this page.