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.
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
If you get the error legacy-install-failure when trying to install a Python package using pip, you can try to fix it by following the below options.
- If you are using Python3 make use of pip3 instead of pip and see if it works.
- Make sure that the pip/pip3 installations is up-to-date. If not update using the below command.
For pip:
For pip3:pip install --upgrade pip or python -m pip install --upgrade pip
pip3 install --upgrade pip or python3 -m pip install --upgrade pip
- In the same way, next you update the setuptools and wheel.
For pip:
For pip3:pip install --upgrade setuptools wheel
pip3 install --upgrade setuptools wheel
- Try to create a virtual environment and then install the package within that environment, as this can help to isolate your project dependencies and avoid conflicts.
Step 1: Create a virtual environment
Step 2: Activate the virtual environment:python3 -m venv myenv
-
Linux/Mac
Windowssource myenv/bin/activate
Step 3: Now try to install the package within the virtual environment.\myenv\Scripts\activate
pip3 install package-name
Hope you find this helpful. If not please leave a comment, I am happy to help!
Facing issues? Have Questions? Post them here! I am happy to answer!
Author Info:
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
More Posts related to PIP,
- WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
- How to install multiple Python Packages at once using pip/pip3 command
- Fix - E: Package python3-pip has no installation candidate
- Fix: >>> pip install - SyntaxError: invalid syntax
- Update All Outdated Modules/Packages using pip3
- pip/pip3 ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied
- pip install see the list of all available versions of package
- How to upgrade pip/pip3 package installer for Python
- Check If Python pip modules are outdated and New Version is Available
- Python: How to install psycopg2 using pip
- Fix Python WARNING: You are using pip version 19 however version 21 is available
- Fix: error: legacy-install-failure Python pip/pip3
- Fix: ModuleNotFoundError: No module named pip
- How to fix PIP Install error: subprocess-exited-with-error
- pip install specific version of a Python Package
- How to list all versions of Python Modules Available using pip/pip3
- How to Upgrade Pandas Package
More Posts:
- Convert Hex to ASCII in Java with Example - Java
- AWS CLI Change Default Output Format - AWS
- W3 HTML validator warning Unable to Determine Parse Mode - Html
- Share image and text Twitter using your Android Application Programatically - Twitter
- How to Apply Themes to Notepad++ - NotepadPlusPlus
- How to Make Android TextView Text Bold - Android
- How to remove unwanted Java imports in IntelliJ (alternative of eclipse Ctrl + Shift + O) - Eclipse
- How to enable line numbers in IntelliJ - HowTos