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 pippip3 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\activatepip3 install package-name
Hope you find this helpful. If not please leave a comment, I am happy to help!
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!