Skip to main content

Canned answers

Pip building from source

You're getting this error because pip is trying to build the package from source instead of installing a pre-built version (a wheel). In almost every case, installing a wheel is preferable and much easier.

You can see this because the output says:

Building wheels for collected packages: ...

To confirm, go to PyPI, search for the package that you want to install, then press 'Download files' on the left. You'll see a list of possible distributions of that package. There should be one source distribution and zero or more built distributions (wheels).

Each wheel works for a specific combination of operating system and Python version. If you don't see one for your OS and Python version there, that's why pip is building from source.

The best way around this, roughly (but not canonically) in order from easiest to most difficult:

  • Use a different Python version, one that has a wheel built for it. This may meen you need to either upgrade or downgrade Python.
  • Use a different version of the package you're trying to install. Package maintainers change the target version of Python over time. Older versions generally have wheels built for older versions of Python.
  • Use a different package altogether, depending on what it is you need to do.
  • Try to get the package to build from source. But if you do this, don't expect to get a lot of help here. Better to check the package-specific documentation for developers.