37

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 6
    "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/"—did you try this? The error tells you what the problem is and how to fix it. – ChrisGPT was on strike Feb 06 '22 at 17:16
  • @Chris This method did not work, same problem, thanks for your comment – Ahmad Sadek Albasatneh Feb 07 '22 at 14:20
  • 1
    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. – ChrisGPT was on strike Feb 07 '22 at 14:26
  • This is a pretty old version of AllenNLP. Do you really need to install a version this old? – Dirk Groeneveld Feb 23 '22 at 00:47
  • 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. – chepner Mar 19 '22 at 18:30

17 Answers17

36

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jose Moran
  • 393
  • 3
  • 2
  • 9
    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 originally – yungmaz13 Sep 10 '22 at 14:19
  • 1
    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. – Scotrraaj Gopal Jun 17 '23 at 21:27
5

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
2

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
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.

Shidouuu
  • 368
  • 4
  • 14
1

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

Download and install or update

Akash Darji
  • 187
  • 1
  • 6
  • 2
    I do not see how this answers the question at the top of this page, but it should. Please [edit] according to [answer] or delete the answer. Otherwise it risks being flagged as "not an answer" and being deleted. – Yunnosch Jul 14 '22 at 21:39
1

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Chafik Boulealam
  • 516
  • 5
  • 10
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]
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
1

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
MMarcelo
  • 11
  • 2
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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Artorius
  • 48
  • 4
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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 1
    You're using two different compilers. It is more likely that using MSVC is what solved the problem. – Shidouuu Mar 19 '22 at 18:02
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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
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]
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jithin Palepu
  • 596
  • 1
  • 7
  • 18
-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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Dmitry Dronov
  • 350
  • 3
  • 11
-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/

ejuhjav
  • 2,660
  • 2
  • 21
  • 32
  • What has this to do with the question? An explanation would be in in order. Is it a response to [Marcelo Archanjo's answer](https://stackoverflow.com/questions/71009659/message-note-this-error-originates-from-a-subprocess-and-is-likely-not-a-prob/73828390#73828390)? – Peter Mortensen Nov 28 '22 at 10:02
-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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131