Skip to content

Solving "Microsoft Visual C++ 14.0 or greater is required" Error in Python

When installing Python packages that require compilation, you may encounter the error: "Microsoft Visual C++ 14.0 or greater is required." This occurs because certain Python packages contain components written in C/C++ that need to be compiled during installation.

Understanding the Error

The error indicates that your system lacks the necessary build tools to compile C/C++ code for Python packages. Many scientific, data analysis, and performance-critical Python packages rely on compiled extensions for optimal performance.

The most comprehensive solution is to install the Microsoft Visual C++ Build Tools:

  1. Download the Visual Studio Build Tools
  2. Run the installer and select "Desktop development with C++"
  3. Under Individual Components, ensure these are selected:
    • Windows 10 SDK (or latest)
    • C++ x64/x86 build tools
    • MSBuild tools

Optional: Silent Installation

For automated installations, use:

batch
vs_buildtools.exe --norestart --passive --downloadThenInstall --includeRecommended --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.MSBuildTools

Large Download

The full installation requires approximately 5-6GB of disk space. If storage is limited, consider alternative solutions.

Solution 2: Use Pre-compiled Wheels

For systems where installing build tools isn't feasible, pre-compiled Windows wheels provide an excellent alternative:

  1. Visit Christoph Gohlke's Python Libraries
  2. Search for your required package
  3. Download the appropriate .whl file matching your Python version and architecture
  4. Install using pip:
bash
pip install package_name‑version‑pyversion‑none‑any.whl
Example: Installing multidict and frozenlist
bash
# Download the appropriate .whl files first
pip install .\multidict-6.0.2-py3-none-any.whl
pip install .\frozenlist-1.3.0-py3-none-any.whl

Solution 3: Use Conda Environment

Conda often handles native dependencies automatically and includes the necessary runtime components:

bash
# Create a new conda environment
conda create -n myenv python=3.9
conda activate myenv

# Install packages - conda may handle dependencies better
conda install package_name

Solution 4: Portable Build Tools (Limited Space)

If disk space is extremely limited, consider PortableBuildTools, which provides minimal components required for compilation.

Advanced Users Only

Portable build tools may not include all necessary components and require manual environment configuration.

Solution 5: Downgrade Python Version

Some packages may not have wheels available for the latest Python versions. Downgrading to a widely supported version (like 3.9 or 3.10) can resolve compatibility issues:

bash
# Using conda to install older Python version
conda create -n py39 python=3.9
conda activate py39

Troubleshooting Tips

  • Ensure pip, wheel, and setuptools are updated:

    bash
    python -m pip install --upgrade pip wheel setuptools
  • If using conda, verify environment variables are correctly set after installing build tools

  • Check package-specific installation instructions, as some may have special requirements

Conclusion

The "Microsoft Visual C++ 14.0 required" error has multiple solutions depending on your constraints:

  • Full capability: Install Microsoft C++ Build Tools
  • Limited space: Use pre-compiled wheels from reliable sources
  • Simplest approach: Use conda environments
  • Compatibility: Consider downgrading Python version

For most users, installing the official Microsoft C++ Build Tools provides the most reliable long-term solution for working with Python packages requiring compilation.