In Python, you can install library packages with the pip
command. Using pip
is convenient because you only need to copy or type a command to install and manage. Sometimes in the process of installing a library, you will encounter the error “Error: legacy-install-failure with pip install”. Let’s find a solution together.
Why does Error: legacy-install-failure with pip install happen?
There are some libraries when you install it. This error will occur. Let’s look at the different cases.
When installing the gensim package
When you install Gensim with the following command:
pip install gensim
Error: legacy-install-failure with pip install can happen because you use an old version of pip
, pip
is used to install packages, and the wheel
is for pip
to reference. The solution in this case is to upgrade both pip
and wheel
When installing the Pandas package
Pandas is a high-level library for manipulating data. It’s flexible and fast. The error may occur because Pandas does not support the version of Python that you are installing on your machine.
When installing the Basemap package
Basemap is a tool to help you quickly create maps. It’s based on the matplotlib library. It has geographic projections that allow plotting subcomponents, boundaries, etc. This library is very prone to errors when you install it via pip. The best way is to download and install it.
How to fix Error: legacy-install-failure with pip install
Depending on different library packages, there will be different solutions.
Solution when installing Gensim
The error may be caused by you using an old version of pip
. Try upgrading pip
and wheel
The first is to upgrade pip with the syntax:
python - m pip install – upgrade pip
Then upgrade the wheel with the syntax:
pip install - upgrade wheel
next upgrade setuptools
pip install - upgrade setuptools
And finally, proceed to install Gensim:
pip install gensim
Solution when installing Pandas
The cause of the error may be because Pandas does not support the version of pip
you are using. Try installing via pipwin
First, install pipwin with the syntax:
pip install pipwin
Then use pipwin to install Pandas with the syntax:
pipwin install pandas
This can help you to solve the error and help you to install Pandas
Solution when installing Basemap
For Basemap, you should proceed to download by going to the following website and install it.
https://www.lfd.uci.edu/~gohlke/pythonlibs/#basemap
Then if you are using Windows, you install the syntax:
pip install [basemap package that you have downloaded]
You can learn more about some common Python errors
Summary
The article has shown the cause of the Error: legacy-install-failure with pip install is mainly due to use old of versions, the best solution is to download directly the package you want to install and upgrade to the new pip
version. Hope you resolve the error quickly.

Carolyn Hise has three years of software development expertise. Strong familiarity with the following languages is required: Python, Typescript/Nodejs, .Net, Java, C++, and a strong foundation in Object-oriented programming (OOP).