Are you getting the Error: legacy-install-failure with pip install error ? If yes then you have come to the right place. In this post you will learn how to solve the error Error: legacy-install-failure with pip install.
Why Error: legacy-install-failure Error comes ?
There can be many reason for getting this error. It can be outdated version of pip, setuptools and wheel packages. It’s possible that you’re encountering a specific error related to a particular Python package or library.
In the next section you will learn how to solve this issue with various solutions.
Solution of Error: legacy-install-failure Error
Solution 1: Update the pip package
The first solution is to update the pip package to the latest version.
Use the below command to install or upgrade the pip package.
pip install --upgrade pip
You can also you the easy_install to update the pip package.
easy_install --upgrade pip
Solution 2: Update the setuptools package
If the error continue then you have update the setuptools package.
Use the below command to update it.
pip install --upgrade setuptools
pip3 install --upgrade setuptools
python -m pip install --upgrade setuptools
Solution 3: Update the wheel package
If the error is not resolved then you have to update the wheel package.
To do so use the below command.
pip install --upgrade wheel
pip3 install --upgrade wheel
python -m pip install --upgrade wheel
Solution 4: Install the .whl file from the source
You can also fix the legacy error if you download the .whl for the package from the URL and install it.
After downloading the file you have to use the pip or pip3 command to install the package in .whl format.
Use the below command for that
pip install your_package.whl
pip3 install your_package.whl
Solution 5: Check the python version
Sometime the package you want to install is not supported for the specific python version. So you have to check the version of the python installed in your system.
Check the version using the below command.
python --version
If the current package or the .whl file is not supported for the checked version of the python then you can install the specific version from python official download website.
Conclusion
The error Error: legacy-install-failure can occur when you are unable to install the specific package in your system. To solve this error you can use the above solutions. You can update the pip,wheel and setuptools before running the pip install command.
Leave a Reply