Programming these days has become far easier thanks to the number of different libraries and tools available to us. However, as simple as its supposed to be, there are still random bugs and errors that might hinder your progress.
In this article, we’re taking a look at the “error: legacy-install-failure” issue in Pip when installing a package.
Also read: How to solve the Tower of Hanoi problem using Python?
Why does this happen?
The error usually gets triggered when you try to install the gensim Python package. The error itself is most likely generated from a subprocess and is not a problem with Pip itself.
How to fix this?
Here are three fixes you can try out.
Update Pip and its dependencies
The first thing you should do in such situations is to update Pip, wheel and setuptools. Just enter the following commands one after another.
python -m pip install –upgrade pip
pip install –upgrade wheel
pip install –upgrade setuptools
Once you’re done updating everything, try to install the package again using either of the following commands.
pip install gensim
Or
pip3 install gensim
Download Microsoft C++ build tools
Another solution to the problem, one that the error message itself will likely suggest is to download and install Microsoft C++ build tools. The download process is rather simple as well, just head over to this website and download the desktop environment with C++. Once the download is complete, run the installer and your error should be resolved.

Alternatively, you can use the following command in the Command Prompt.
vs_buildtools.exe --norestart --passive --downloadThenInstall --includeRecommended --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.MSBuildTools
Once installation is complete, run the aforementioned command to install the gensim package again.
Using unofficial Windows Binaries
Although we don’t recommend downloading binaries or system files from third-party sources, this might be the last resort if you absolutely have to use gensim.
If you’re running Windows 10 or 11 (x64) and have Python 3.10 or above, you need to visit this link and download the gensim‑4.1.2‑cp310‑cp310‑win_amd64.whl file. Once downloaded, install the file with pip using the following command.
pip install [path to wheel file]
The problem should be gone now.
Also read: Is Python case sensitive when dealing with identifiers?