Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Can't install packages

I'm trying to install a package on Python, but Python is throwing an error on installing packages. I'm getting an error every time I tried to install pip install google-search-api.

Here is the error how can I successfully install it?

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/  

I already updated that and have the latest version of 14.27 but the problem is throwing the same error.

like image 430
wloleo Avatar asked Oct 08 '20 11:10

wloleo


People also ask

Why can't I install packages in Python?

The first reason that prevents you from installing the latest package versions is dependency error. A possible solution is to check the latest versions of the package and to install one which is: supported by your version. doesn't have dependency issues.

Why can't I install using pip?

This error usually means there's a problem with the Python installation or the system variable PATH is not set up correctly. Try reinstalling Python and all its components to fix the problem. The easiest way is via the Python executable installer.


2 Answers

Go to this link and download Microsoft C++ Build Tools:
https://visualstudio.microsoft.com/visual-cpp-build-tools/

enter image description here

Open the installer, then follow the steps.

You might have something like this, just download it or resume.

MSBT

If updating above doesn't work then you need to configure or make some updates here. You can make some updates here too by clicking "Modify".

Check that and download what you need there or you might find that you just need to update Microsoft Visual C++ as stated on the error, but I also suggest updating everything there because you might still need it on your future programs. I think those with the C++ as I've done that before and had a similar problem just like that when installing a python package for creating WorldCloud visualization.

C++ Build tools


UPDATE: December 28, 2020

You can also follow these steps here:

  1. Select: Workloads → Desktop development with C++
  2. Then for Individual Components, select only:
    • Windows 10 SDK
    • C++ x64/x86 build tools

You can also achieve the same automatically using the following command:

vs_buildtools.exe --norestart --passive --downloadThenInstall --includeRecommended --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.MSBuildTools 

Reference:
https://www.scivision.dev/python-windows-visual-c-14-required

like image 175
Ice Bear Avatar answered Sep 17 '22 17:09

Ice Bear


  1. Upgrade your pip with: python -m pip install --upgrade pip

  2. Upgrade your wheel with: pip install --upgrade wheel

  3. Upgrade your setuptools with: pip install --upgrade setuptools

  4. close the terminal

  5. try installing the pacakage again.

Boom !!! it works.

like image 30
Prason Ghimire Avatar answered Sep 21 '22 17:09

Prason Ghimire