Message "error: Microsoft Visual C++ 14.0 or greater is required."
Asked Answered
M

21

50

While downloading pip install allennlp==1.0.0 allennlp-models==1.0.0, I faced this problem:

        [6 lines of output]
        running bdist_wheel
        running build
        running build_py
        running build_ext
        building 'srsly.msgpack._unpacker' extension
        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/
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for srsly
      Failed to build thinc blis srsly
      ERROR: Could not build wheels for srsly, which is required to install pyproject.toml-based projects
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I have downloaded:

pip install -vvv torch
pip install numpy
pip3 install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html

and it still not working.

I am using Python 3.10.2 on Windows 11 Pro.

What should I do?

Mignon answered 6/2, 2022 at 17:14 Comment(5)
"error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": visualstudio.microsoft.com/visual-cpp-build-tools"—did you try this? The error tells you what the problem is and how to fix it.Twiddle
@Twiddle This method did not work, same problem, thanks for your commentMignon
What does "did not work" mean? Are you still getting the same error message? Then it was not done correctly, or at least the Python build tools can't find it. And if you're getting a different error message, please share it with us.Twiddle
This is a pretty old version of AllenNLP. Do you really need to install a version this old?Baecher
It would be nice if pip could capture the original error, display the "subprocess, not me" boilerplate first, then end with the "real" error that you need to address.Cuttlebone
W
44

I had Python 3.10 and had the same error installing psutil from pip. I fixed the problem by installing an older version of pip using the command:

pip install pip==21.3.1
Willie answered 2/6, 2022 at 1:12 Comment(3)
Didn't work for me ERROR: Command errored out with exit status 1:, ERROR: Failed building wheel for rpi.gpio after trying to install rpi.gpio after using this method since I had the same error as the question originallyPolarimeter
I had Python 3.8.10. Installing pip upgrade to latest version caused this issue. Downgrading it back down to v20.0.2 did it for me.Jarlen
downgrading pip works for meMildred
F
13

I have tried multiple solution it didn't worked. Finally found working solution. run the below command.

pip install wheel setuptools pip --upgrade
Foliose answered 8/9, 2023 at 13:19 Comment(1)
This worked for me! Chip Apple M1 Pro pip version 23.2.1Generally
I
6

You have to install the Python 3.9.10 version from python.org and after installation, upgrade your pip and everything will be sorted.

It is the problem in Python 3.10.2... This method is working. I was suffering from the same problem in installing the turtle, so I did that and error was solved.

Ingles answered 26/3, 2022 at 3:7 Comment(1)
It didn't work for me, same problem.Mignon
C
4

To solve this problem, you need to download Visual Studio from its main page.

If Visual Studio is already installed, then when you run the installer, you can modify it (by clicking the modify button):

Enter image description here

During Visual Studio installation (or installation modification) choose Desktop Development with C++:

Enter image description here

Chantal answered 15/8, 2022 at 14:7 Comment(0)
R
3

If you're using a Python 3 image, this might help:

RUN apk update
RUN apk add make automake gcc g++ subversion python3-dev

Reference from Problems with pip install numpy - RuntimeError: Broken toolchain: cannot link a simple C program

Radiology answered 19/4, 2022 at 3:50 Comment(0)
I
3

Microsoft Visual C++ 14.0 or greater is required.

You must be install build visual tools 15, 17, 19, or greater.

Download from Microsoft C++ Build Tools.

Irritated answered 2/5, 2022 at 14:37 Comment(0)
S
2

https://visualstudio.microsoft.com/visual-cpp-build-tools/

Download and install or update

Sit answered 4/4, 2022 at 16:45 Comment(1)
I do not see how this answers the question at the top of this page, but it should. Please edit according to How to Answer or delete the answer. Otherwise it risks being flagged as "not an answer" and being deleted.Silvertongued
V
1

This particular error is caused by not having a C/C++ compiler installed. As said in the error message, either install MSVC or another compiler to compile it.

Please read your error messages; they are there for a reason.

Vulturine answered 19/3, 2022 at 18:8 Comment(2)
I downloaded and installed it but I got the same problem again, I don't know why, but I tried all the ways I got and it didn't workMignon
@AhmadSadekAlbasatneh Have you tried restarting you computer?Vulturine
I
1

I had a similar problem while installing with pip3: building wheel for box2d-py (setup.py) ... error

The solution was just to install SWIG prior to box2d, so I added the following steps manually:

  1. pip install swig
  2. pip install gym[box2d]
Intermezzo answered 15/8, 2022 at 6:16 Comment(1)
It worked for me using Google colabEstheresthesia
A
1

First: You installed the Mingw-w64 compiler with a full MSYS2 package, and this package included Python.

Second: you get the error because the plugin is not in the Python packages installed by MSYS2.

So: uninstall MSYS2 and install a minimalistic MinGW (MinGW - minimalistic GNU for Windows).

And finally Install a version of Python from the official Python page. Now if you can install plugins.

Arteritis answered 13/11, 2022 at 6:20 Comment(0)
E
0

I've found a similar question from GitHub, and credits goes to thaibee. Here I quote:

It's a problem with Microsoft products and is very easy to solve.

If you can't install these plugins as well, need to download it from other repositories like this one:

https://www.lfd.uci.edu/~gohlke/pythonlibs/ depends on the version of python and the system.

For example: for my Windows 11 (x64) and Python 3.10 I took this file: pyodbc‑4.0.32‑cp310‑cp310‑win_amd64.whl

It's very easy to install: pip install pyodbc‑4.0.32‑cp310‑cp310‑win_amd64.whl

After it, the system works well and didn't ask you about VC.

This solution I found in problem with the MySQL plugin for Django. I don't understand why - but they also use VC for the installation process.

Erasion answered 7/2, 2022 at 4:15 Comment(2)
Of course it's possible to build from source with the right build tools. Where do you think Christoph Gohlke's packages come from? It may be trickier than it is on other platforms, but it's definitely possible.Twiddle
Some models are not found in: lfd.uci.edu/~gohlke/pythonlibsMignon
A
0

I understand your problem, and I have faced it too. I tried multiple solutions, but it didn't work, so I simply uninstalled my Python and installed some older version of it. Example: I recently uninstalled Python 3.10.2 and installed 3.9.10.

It worked without any errors.

Auxiliaries answered 24/2, 2022 at 4:38 Comment(1)
It didn't work for me, same problem.Mignon
I
0

I was facing the same problem when executing:

python -m pip install package-name

After many failed tentatives, what fixed the problem for me was executing:

py -m pip install package-name

When I type py in the terminal, it shows this information:

Python 3.9.8 (tags/v3.9.8:bb3fdcf, Nov  5 2021, 20:48:33) [MSC v.1929 64 bit (AMD64)] on win32

When I type python in the terminal, it shows this information:

Python 3.8.2 (default, Apr  9 2020, 13:17:39)  [GCC 9.3.0 64 bit (AMD64)] on win32

I believe that this problem is related to the Python interpreter version.

Insular answered 24/2, 2022 at 13:55 Comment(1)
You're using two different compilers. It is more likely that using MSVC is what solved the problem.Vulturine
C
0

For Mac, there is a possible workaround for this problem if you use Conda. The idea is to create an x86 environment on the Mac and do your pip install after that.

conda create -n <name>
conda activate <name>
conda config --env --set subdir osx-64
conda install python=3.8

Here I choose Python 3.8, but you can choose another version.

Canker answered 23/9, 2022 at 13:22 Comment(0)
T
0

If you are on macOS (maybe Apple silicon) then first try to do this from your base location of the terminal:

eval "$(/opt/homebrew/bin/brew shellenv)"

Then, do brew update and brew upgrade.

Once you are done with that, type

brew install geos

Now again go to your virtual environment and activate it (if you are working in the virtualenv) and then type:

python3.10 -m pip3 install [module name]
Trahern answered 26/10, 2022 at 22:7 Comment(0)
I
0

I see this error because i use the msys2's Python to creat a venv python.This because My Windows is new And I not install Python,but I setup msys2 to install MinGW.

Intend answered 24/9, 2023 at 9:54 Comment(0)
C
0

I had the same issue installing with pip or conda in a conda environment. I solved it only with PyCharm by ask it to install the package, in my case, gdal.

So, I chose my env and it offer to install by itself since the gdal==3.6.2 was in my requirements.txt file.

Counterclockwise answered 29/11, 2023 at 2:51 Comment(0)
W
0

Many of the machine learning libraries doesnot support python 32 bit,so solution is to shift to 64 bit python

Weak answered 2/12, 2023 at 11:11 Comment(0)
O
-1

I tried all recommendations that were written, but none worked. My Python was 3.11.

So I just installed Python 3.8.10 from here:

https://www.python.org/downloads/release/python-3810/

And ran

C:\Python38\python.exe -m pip install matplotlib

And it worked.

Outwash answered 17/7, 2022 at 19:7 Comment(0)
T
-2

We can install DVC with the below commands:

conda install -c conda-forge mamba # installs much faster than conda

mamba install -c conda-forge dvc 

For more information please refer this: https://dvc.org/doc/install/

Turmel answered 8/11, 2022 at 7:55 Comment(1)
What has this to do with the question? An explanation would be in in order. Is it a response to Marcelo Archanjo's answer?Prentice
F
-2

I faced a similar problem while installing pandas-datareader.

I was using Python 3.11.0, and after trying all possible solutions, I downloaded Python 9.10.0 and it worked fine.

Fearful answered 24/11, 2022 at 8:35 Comment(1)
'python v9.10.0' -- Did you mean v3.9.10?Wareing

© 2022 - 2024 — McMap. All rights reserved.