Link to home
Start Free TrialLog in
Avatar of ukerandi
ukerandiFlag for United Kingdom of Great Britain and Northern Ireland

asked on

error: Unable to find vcvarsall.bat

Hi Experts,
I get when I try to pip install a python library called probfit.  My python is 3.7.

error: Unable to find vcvarsall.bat
Avatar of David Favor
David Favor
Flag of United States of America image

Provide your entire pip3 install output, as text not image capture.
Avatar of noci
noci

Python and windows... an almost happy marriage..:
Please read this:
https://devblogs.microsoft.com/python/unable-to-find-vcvarsall-bat/
vcvarsall.bat is a windows batchfile (commandline script) to establish the environment for to compile and link Visual C++ projects at the commandline rather than using the Visual Studio IDE. since you tagged your question with LINUX but not WINDOWS, you probably got a wrong python setup.

if you want to use python on Windows, vcvarsall.bat could be found if you install visual studio and vc++ at your computer. there are free 'community' versions of visual studio. i would assume that all visual studio versions since VS 2010 would work.

Sara
Avatar of ukerandi

ASKER

@Sara
Sorry it's mistake to tag Linux.It's in the Windows
I fixed the keywords. ( removed Linux, Added Windows OS).
@noci Thank you very much
Try pip install probfit to grab a compiled version of probfit instead.
@☠ MASQ ☠
Thank you very much your reply. Can you send me the link please
I think this is included in noci's link but pip should compile the project if there's Windows support otherwise you'll need to compile it yourself
You run that command at the Python prompt.
I don't think there's a better link than noci's other than pointing you at the Devs page
https://pypi.org/project/probfit/
@David Favor

ERROR: Command errored out with exit status 1: 'c:\users\marta\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-install-luty5mcs\\iminuit\\setup.py'"'"'; __file__='"'"'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-install-luty5mcs\\iminuit\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-record-o1xtk479\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
ERROR: Command errored out with exit status 1:
   command: 'c:\users\marta\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-install-luty5mcs\\iminuit\\setup.py'"'"'; __file__='"'"'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-install-luty5mcs\\iminuit\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-wheel-nigag5c0' --python-tag cp35
error: Unable to find vcvarsall.bat
What was the exact command you typed to begin with... maybe something like...

pip3 install probfit

Open in new window


Or something similar to this.

Best to provide a starting point, so people can attempt recreating exactly what's occurring.
Unable to find vcvarsall.bat

did you install visual studio?

if no, you would need to prevent the python setup to build the extension that needs a commandline build using  visual c++ compiler and linker cl.exe.

if yes, you have to locate the vcvarsall.bat and if found add the path to the folder where it resides to the PATH environment variable.

to locate the .bat file, open a cmd.exe command window and then type

dir /s "%ProgramFiles(x86)%"\vcvarsall.bat

Open in new window


(at my system more than one file was found. i would use the last one at C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC)

to add it to the PATH environment variable go to 'system settings' 'system' 'advanced' 'environment variables'. here at system variables you will find 'Path' variable where you add the found vc path to the end of the currently defined paths separated by a semicolon ;

note, a new Path would only be available if you restart the command window or explorer.

to test whether the new folder was added to PATH open a command window and type PATH.

Sara
@David Favor

see attached Doc
command.docx
@Sara.

It's saying invalid switch - " vcvarsall.bat"
see attached doc
command.docx
@David Favor
The command I tried is 'pip install probfit'. I also tried 'pip3 install probfit'.
@Sara: see attached screenshot.the .bat file is available but invalid switch - " vcvarsall.bat"
User generated image
invalid switch

look at my command

dir /s "%ProgramFiles(x86)%"\vcvarsall.bat

it uses a backslash \  while your command uses (forward) slash /.

at the cmd level you can't exchange \ by /

Sara
copy the vcvarsall.bat into the folder where you type the install command. that way it was found by the installer in any case.

you also could run the vcvarsall.bat yourself. then it would establish the environment for commandline builds using vc++ cl.exe. i would assume that the installer wouldn't run vcvarsall.bat again if it finds all done already.

Sara
@sarah,

I corrected the command and it shows the folders I introduced in the path list.

I don't understand what folder I should copy vcvarsall.bat into.
Also I don't know how to run vcvsarsall.bat myself. that's mean double click on the bat file and ran?
did you run the installer from windows explorer? then, you could copy vcvarsall.bat (by copy and paste) into the same folder where the setup program is located.

if you run the installer from cmd window, then type simply

vcvarsall.bat

Open in new window

 

to run the batch file. the file was found by windows because its location is in the PATH.

if the installer still has problems to locate the batch file, you could copy the vcvarsall.bat by

copy "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" .

Open in new window


the final dot . is a shortcut for the path to the current directory.

if the installer still has problems, post the error you got. you can get the contents of your dos-box by clicking onto the icon of the command window at top-left, choose Properties, and check the QuickEdit mode. if done, you can select text from dos-box with the mouse and put the selected contents into the clipboard by <Enter>. the contents can be pasted in the dos-box by right-click with mouse or into any windows textbox by CTRL+V.

Sara
@sara
I manage to run the program from the command prompt but even then it says it can't the file.
@sara
any idea
can you show me the whole error message? is there a path given which could not be found? did you run the batchfile from command line prior to installation?

can i download the package from somewhere? did you check the readme?

Sara
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.