How to Fix Error: legacy-install-failure with pip install

Diagram of How to Fix Error: legacy-install-failure with pip install


The legacy-install-failure error with pip install occurs when a Python package cannot be installed in “legacy” mode. This can happen when pip tries to install a package that does not provide a wheel distribution, and the installation fails for some reason.

To fix the “Error: legacy-install-failure” error:

  1. Upgrade your pip, setuptools, and wheel versions before running the pip install.
  2. Check if the package supports your Python version.
  3. On Windows, download and install the package from unofficial binaries.
  4. Try to install the package with the –pre option.

Solution 1: Upgrade pip

Upgrading pip might solve your issue as newer versions of pip have better handling of errors and dependencies:

python -m pip install --upgrade pip

If you are using a specific version of Python, replace a Python with your Python version, like python3 or python3.9.

Solution 2: Install wheel

The package you’re trying to install may require the wheel package.

You can install it with the following:

pip install wheel

Solution 3: Check Python and package compatibility

Ensure the package you are installing is compatible with your Python version. Some packages do not work with specific versions of Python. You can usually find this information in the package documentation.

Solution 4: Install package from source

If you cannot install a package from PyPI, try installing it from the source.

You can typically find the source code on the package’s GitHub page. But first, clone the repository and run the Python install in the repository directory.

Check for specific errors

The “legacy-install-failure” message is a general error message. There might be specific error messages above this line that can give you more information about what went wrong.

I hope one of these above solutions works for you!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.