Are you getting the error “error: legacy-install-failure” when installing the package using PIP? Yes, you have come to the right place. Today, I will show you how to solve this error.
This error can occur for various reasons. You will see all solutions today, and you can apply these solutions to solve this error, “legacy-install-failure.“
Related Post: wxPython error: legacy-install-failure [Fixed]
[Fixed]: Error: legacy-install-failure
- Before running the ‘pip install‘ command. Upgrade “pip, setuptools, and wheel” to get rid of this error.
- You should check the compatibility of the package with the Python version.
- If you are a windows user you can install the python package from unofficial binaries.
- You can use ‘–pre‘ with the pip install command to get rid of this error.
Failed to build X
Installing collected packages: X
× Running setup.py install for X did not run successfully.
│ exit code: 1
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> X
The first and easiest solution is to upgrade your pip version. Here are the commands to upgrade your pip version.
Commands to –Upgrade PIP
# If pip is already installed in your system
pip install --upgrade pip
# If your pip is aliased as pip3
pip3 install --upgrade pip
# If you don't have pip in your PATH environment variable you can use Python before command.
python -m pip install --upgrade pip
python3 -m pip install --upgrade pip
py -m pip install --upgrade pip
# If you have easy_install you can install packages using easy_install
easy_install --upgrade pip
# If you get a permissions error yo can run command as admin
sudo easy_install --upgrade pip
# If you get a permissions error when upgrading pip you can upgrde for a specific user
pip install --upgrade pip --user
# Installing directly from get-pip.py (for Linux and Mac users)
curl https://bootstrap.pypa.io/get-pip.py | python
# If you get permissions issues you can run this command
curl https://bootstrap.pypa.io/get-pip.py | sudo python
# Alternative for Red Hat / CentOS / Fedora
sudo yum install epel-release
sudo yum install python-pip
sudo yum update python-pip
Now try to install the package you are trying to install before upgrading the PIP. I hope your problem is solved now. If you are still getting this error. Don’t worry, now upgrade your setuptools and wheel.
pip install --upgrade setuptools wheel
pip3 install --upgrade setuptools wheel
python -m pip install --upgrade setuptools wheel
python3 -m pip install --upgrade setuptools wheel
py -m pip install --upgrade setuptools wheel
You updated “setuptools and wheel“, still getting the error “Error: legacy-install-failure“? Well, now run your pip command with –no-cache-dir.
pip install <package name> --no-cache-dir
pip3 install <package name> --no-cache-dir
If you are still getting the error, you can download the Python package manually and then install it from your local machine.
Conclusion on Error: legacy-install-failure
Programmers, We discussed how we can solve the error “error: legacy-install-failure“. If you are still getting the error please let us know in the comments section. Before running the ‘pip install‘ command. Upgrade “pip, setuptools, and wheel” to get rid of this error.