Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install error: Microsoft Visual C++ 10.0 is required

I have Python 3.4, running on Windows 10 x64, trying to install pylint via pip: pip install pylint.

When doing so, I get the following error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279

However I already have:

  • Microsoft Visual C++ 2010 x64, Microsoft Visual C++ x86 both Redistributable
  • Microsoft Visual C++ 2013 x64, Microsoft Visual C++ x86 both Redistributable
  • Microsoft Visual C++ 2015 - 2019 x64, Redistributable
  • Microsoft Visual C++ 2017 x64, Microsoft Visual C++ 2017 x86 both Redistributable

I saw some other posts with possible solutions that I've tried and did not seem to help to me -

  • updating setuptools and virtualenv

  • Downloading the SDK given in the error

  • Add VS110COMNTOOLS, VS120COMNTOOLS, VS140COMNTOOLS env variables

Of course, after every attempt I've rebooted my PC.

What else could I try to fix this?

Is it possible to install pylint without pip?

like image 895
ChikChak Avatar asked Aug 20 '19 21:08

ChikChak


People also ask

How do I fix Visual C++ not installing?

The Microsoft Visual C++ installation error might be caused by corrupted registry keys. In this case, the Microsoft Program Install and Uninstall troubleshooter could resolve the issue. The Microsoft Program Install and Uninstall Troubleshooter will scan and repair corrupted registry keys.

How do I install Microsoft Visual C++ on Windows 10?

The Redistributable is available in the my.visualstudio.com Downloads section as Visual C++ Redistributable for Visual Studio 2019 - Version 16.7. Use the Search box to find this version. To download the files, select the platform and language you need, and then choose the Download button.

What is Microsoft Visual C++ 2010 x64 redistributable?

The Visual C++ Redistributable Packages install runtime components that are required to run C++ applications built with Visual Studio 2012.


2 Answers

You don't have any Visual C++, you only have Redistributable packages. They install run-time libraries that are used to run applications written with VC. But you need Visual C++ compiler! Install Visual Studio 2010 Express.

See also https://stackoverflow.com/search?q=%5Bpip%5D+%22Microsoft+Visual+C%2B%2B+10.0+is+required%22

like image 98
phd Avatar answered Oct 05 '22 07:10

phd


Python 3.4

According to [Python]: PEP 429 -- Python 3.4 Release Schedule (emphasis is mine):

Python 3.4 has now reached its end-of-life and has been retired. No more releases will be made.

The last version (3.4.10) was released on 2019/03/18.

So, you should move away from it (I'd recommend the (current) LTS version: 3.7). That doesn't magically solve all possible problems, but being a newer version, it requires newer build tools (VStudio) which are easier to find, and have a higher probability of installing and running correctly.

Notes:

  • Even if you manage to solve the problem for this version, you'll be likely to run into it again when trying to install other such packages, as more and more of them will no longer support it

  • Python 3.5+ are built with VStudio 14.X. Starting with VStudio 2015 (14.0), MS did some changes to improve backward and forward compatibility between VStudio versions. More details on [SO]: How to circumvent Windows Universal CRT headers dependency on vcruntime.h - (@CristiFati's answer)

2. Pylint

[PyPI]: Pylint is written entirely in Python (I checked the source code), so it wouldn't require a C(++) compiler. This is also backed up by the existence of the pylint-2.3.1-py3-none-any.whl file (available for download).
Some of its dependencies (wrapt, typed-ast: which don't have prebuilt binaries for Python 3.4 on Win - makes sense considering the previous bullet) require it.

According to [PyPA]: pip install - Options (pip install -h):

--no-deps

    Don’t install package dependencies.

Now, I don't know your Pylint usecase: whether you are using the parts of it that require the above dependencies, but if you don't, simply pass the --no-deps argument.

[cfati@CFATI-5510-0:e:\Work\Dev\StackOverflow\q057581571]> sopr.bat
*** Set shorter prompt to better fit when pasted in StackOverflow (or other) pages ***

[prompt]> "e:\Work\Dev\VEnvs\py_064_03.04.04_test0\Scripts\python.exe" -c "import sys;print(sys.version)"
3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)]

[prompt]> "e:\Work\Dev\VEnvs\py_064_03.04.04_test0\Scripts\python.exe" -m pip freeze

[prompt]> "e:\Work\Dev\VEnvs\py_064_03.04.04_test0\Scripts\python.exe" -m pip install --no-deps pylint
Collecting pylint
  Using cached https://files.pythonhosted.org/packages/60/c2/b3f73f4ac008bef6e75bca4992f3963b3f85942e0277237721ef1c151f0d/pylint-2.3.1-py3-none-any.whl
Installing collected packages: pylint
Successfully installed pylint-2.3.1
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

[prompt]> "e:\Work\Dev\VEnvs\py_064_03.04.04_test0\Scripts\python.exe" -m pip freeze
pylint==2.3.1

[prompt]>
[prompt]> :: Pylint dummy usage example - just import it
[prompt]> "e:\Work\Dev\VEnvs\py_064_03.04.04_test0\Scripts\python.exe" -c "import pylint;print(pylint)"
<module 'pylint' from 'e:\\Work\\Dev\\VEnvs\\py_064_03.04.04_test0\\lib\\site-packages\\pylint\\__init__.py'>

As seen, the package was installed, and it's usable.

Notes:

  • There are (official) prebuilt Python 3.5 (and newer) binaries for typed-ast, but not for wrapt, so a Python upgrade will still require building it (assuming that it's needed)
  • You could always turn to unofficial prebuilt binaries. [UCI.LFD]: Unofficial Windows Binaries for Python Extension Packages is the most comprehensive repository (that I know of), and contains the wrapt build for Python 3.4 (but doesn't the typed-ast one :) )

3. Or else ...

Python 3.4 version is built (on Win) using VStudio 2010 (10.0). Since it's written in C, it requires a C compiler.
More details on [Python.Wiki]: WindowsCompilers.

Every package that contains parts written in C(++) (and needs to be built from sources at pip install time - meaning that there are no prebuilt binaries on the public repository), also requires the compiler (the compiler version must match the one that Python was built with).

The above URL lists the 4 items that need to be installed in order to get things going:

  • Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1
  • Microsoft Windows SDK for Windows 7 and .NET Framework 4
  • The other 2 are dependencies for these 2 (and I tend to think that will be automatically installed)

I didn't (have to) attempt this step, as I already have VStudio 2010 installed. As a side note, I have 7 VStudio versions (with their corresponding SDKs) installed, and also I have 30+ Python instances (installed, VEnvs, custom built by me, installed by other 3rd-party software, ...) on my machine.

Once you get the (above) build tools installed (and the %VS*% env vars pointing to the desired VStudio version - you have to do this manually when having multiple versions), you will be able to install most of the Python packages containing C(++) code.
But there will probably be a few exceptions. Here's an example that gave me some headaches: [SO]: Installing pygraphviz on Windows 10 64-bit, Python 3.6 - (@CristiFati's answer) (check it out - and the URLs it references, there's a bunch of useful information there).

I noticed that you're having some problems installing VStudio 2010. With the risk of repeating myself, switching to a newer Python version would make some of your current problems go away, since it would require newer build tools which are less likely to fail installing.
Everything else still applies, though.

Update #0

Concerning the last inquiry in the question:

It's possible to install Pylint without pip, for example doing (almost) what pip does, but manually. However, from what am I concerned, this would be a (lame) workaround (gainarie). Anyway, here are the steps:

  1. Download and unpack the .whl (from section #2.)
  2. Copy the (inside) pylint dir, under Python's site-packages dir

But again, everything done here is also done properly in #2., so this is truly pointless.

like image 20
CristiFati Avatar answered Oct 05 '22 08:10

CristiFati