Had the same issue (it's related to Visual Studio):
error: command 'C:\\Users\\user1\\AppData\\Local\\Programs\\Common\\Microso
ft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
From control panel - fire up "add remove software" and select modify on Visual Studio - add C++ development. Wait for install to complete, reboot.
Answer from Baked Inhalf on Stack Overflowcommand errored out with exit status 2 when installing a package from local folder
python - Pip install fails with exit code 2 / error code 1 on fastlz module - Stack Overflow
setup.py exit code 2, installing from pip into venv
The Python process failed (exit code: 2)
Videos
Hi there!
So short Intro, I am making a python script/project for like a addon to the game "Elite Dangrous", To do this I am using basically a macro to accomplish the task, for those who know this game it's basically a Fleet carrier auto Route plotter for long disctance trips.
The way the script works is it uses 2 librarys called "pyautogui" and "pydirectinput" to navigate the player UI and peform actions.
I decided to make this since i learned how to read csv files in my classes a few weeks ago.
the code runs fine, but the next step is to impliment the script into another program called EDMC(https://github.com/EDCD/EDMarketConnector) , that can run plugins that are fully written in python(https://github.com/EDCD/EDMarketConnector/blob/main/PLUGINS.md) I was asked to make the script a plugin so that more people can use it.
I have spent a few days trying to make it run, but I have now encountered an error that I have no idea how to fix ot troubleshoot.
subprocess.CalledProcessError: Command '['C:\\Program Files (x86)\\EDMarketConnector\\EDMarketConnector.exe', '-m', 'pip', 'install', 'pydirectinput']' returned non-zero exit status 2.
2021-03-02 14:15:05.670 - ERROR - plug.load_plugins:210: Failure loading found Plugin "FCjumper"
EDMC returns a text file with error codes when it runs and this is the extract, If i should post more of it please let me know and ill give the whole thing.
Here is the link to my Git hub which has the files, It is organized with 2 modules and a load.py file.The load file has the functions required for EDMC to recognise it.
https://github.com/Gorfs/FCAutojumper
i created a new branch REDDIT for yall to see the new files plus the full log for the error, in main there are my previous files, for the files without the EDMC mods, look for the GUI.py, Macro.py and main.py, files in the main branch and run those or alternativly run the FCautojumperandfueller.py to get all the functions in one file.
IF those interested want to try out the code without the plugins bits just call the make_GUI in the load file(make sure that you have all 3 files) and have fun
The second link should have everything required to understand how it works, so If you can understand it, it should give some explanations.
here is the link to a short plugin for EDMC that I am using to understand how to make my own work ,
https://github.com/Exynom/EDMC-HourlyIncome
And also second question would be how would i make it so that It could be its own standalone .exe? whenever I launch the file directly without an IDE it does nothing(when calling the make_GUI ) but when i run it using the IDE it all works? (just a little side question).
Final notes:
I know this is probably a dumb question but after a few hours of looking and only finding things that are WAY to complicated for me to understand i got a bit demotivated. And yes i know this isnt at all good compared to the other plugins, I just wanted to make a little thing to help the comunity out.
Anyway I hope that I didnt just turn people off from helping me with this massive hump of text, (if so, sorry) and of course if anyone wants to use the code to make anything they want you have my full consent, you may edit, copy, distribute as you wish but please add me as a contributor is so. :)
Good day (or night)
P.S if you have any problems seeing the files please comment and ill try to fix it as soon as possible thanks :)
btw if you post a response you are a boss :)
edit1: forgot to say, If anyone here can't figure out what my crappy code means then post in the comments, I'll try to answer question about what I made. :)
» pip install exit-codes
I'm trying to install Stable Diffusion, but I'm getting a weird error code 2 displayed. I have followed the instructions properly, downloaded python 10.6 and github. So, I'm not sure what the problem is or how to fix it. And help would be appreciated.
Both the above methods work nicely.
This one is a bit easier though.
Install Visual C++ 2015 Build Tools from https://go.microsoft.com/fwlink/?LinkId=691126 with default selection.
Came across this issue when installing pycocotools on windows 10. Python 2.7 is incompatible or does not support Visual C++ 14 that is required to compile C99 code. This is the reason for the compiling errors (C2065,C4047 etc).
You need to,
- Install Visual Studio 2015 build tools (this will install C++ 14 compiler).
- Install a new newer version of Python (3.6 recommended)
More about Windows Compilers for Python here.

» pip install exitstatus
I haven't seen this problem in Windows, but for Linux, I would normally reinstall Python after installing the dependencies (such as the MSVC thing). In that case this is especially helpful because I'm often rebuilding (compiling and other related steps) Python/Pip.
Could also just be an error specific to the module and Python version combo you're trying.
From a discussion in the comments:
I have the pyenv-win version manager, so I was able to create venvs and test this for you. With Python 3.10.2, it fails; with Python 3.8.10, it's successful. So, yes, reinstalling does seem to be worthy of your time.
With python3.10
On Windows: First, install vcpkg and install sentencepiece:x64-windows-static
copy the header and lib files from vcpkg/installed/x64-windows-static/include and lib to
C:/Program Files/python310/build/root/include and lib
This should work as the setup.py install expects the library in a ..\build\root\lib directory.
As the C:\Program Files\python310\lib is in the /LIBPATH, the resulting ..\build\root\lib will point to the sentencepiece.lib
If still encounting errors, then set the INCLUDE and LIB environment variables so that the cl.exe , which is called from pip install sentencetransformers finds them.