error: command 'cl.exe' failed: No such file or directory Python 3.4

Will.Beasley picture Will.Beasley · Sep 23, 2015 · Viewed 12.5k times · Source

I've been trying to install pyodbc 3.0.7 by running python setup.py install but continue to have problems. Currently I've hit the "error: command 'cl.exe' failed: No such file or directory" wall. I've looked online for longer than I'd like to admit trying to figure out what is going on.

I'm using a 64 bit version of Python 3.4

I've got Microsoft Visual Studio 10.0.

I've confirmed that vcvarsall.bat is in Program Files (x86)\Microsoft Visual Studio 10.0\VC.

I am running 64 bit so I added the amd64 folder and put vcvars64.bat inside Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64

I confirmed cl.exe is in Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin

I've restarted my computer just to make sure that wasn't the problem.

But when I trying installing pyodbc I get the following

C:\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7>python setup.py install
running install
running bdist_egg
running egg_info
writing pyodbc.egg-info\PKG-INFO
writing top-level names to pyodbc.egg-info\top_level.txt
writing dependency_links to pyodbc.egg-info\dependency_links.txt
reading manifest file 'pyodbc.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'tests\*'
writing manifest file 'pyodbc.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_ext
building 'pyodbc' extension
creating build
creating build\temp.win-amd64-3.4
creating build\temp.win-amd64-3.4\Release
creating build\temp.win-amd64-3.4\Release\Users
creating build\temp.win-amd64-3.4\Release\Users\William
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src
cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DPYODBC_VERSION=3.0.7 -IC:\Python34\include -IC:\Python34\include /TpC:\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src\buffer.cpp /Fobuild\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src\buffer.obj /Wall /wd4668 /wd4820 /wd4711 /wd4100 /wd4127 /wd4191
error: command 'cl.exe' failed: No such file or directory

From there, as a last ditch effort I tried to clean and build but got the same issue.

C:\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7>py -3 setup.py clean --all build_ext --force
running clean
removing 'build\temp.win-amd64-3.4' (and everything under it)
'build\lib.win-amd64-3.4' does not exist -- can't clean it
'build\bdist.win-amd64' does not exist -- can't clean it
'build\scripts-3.4' does not exist -- can't clean it
removing 'build'
running build_ext
building 'pyodbc' extension
creating build
creating build\temp.win-amd64-3.4
creating build\temp.win-amd64-3.4\Release
creating build\temp.win-amd64-3.4\Release\Users
creating build\temp.win-amd64-3.4\Release\Users\William
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src
cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DPYODBC_VERSION=3.0.7 -IC:\Python34\include -IC:\Python34\include /TpC:\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src\buffer.cpp /Fobuild\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src\buffer.obj /Wall /wd4668 /wd4820 /wd4711 /wd4100 /wd4127 /wd4191
error: command 'cl.exe' failed: No such file or directory

I've always used pip so this isn't something I'm familiar with so maybe I did something wrong. Any help and I'd be eternally grateful as I think I've exhausted all resources at this point. (Or a prebuilt copy of pyodbc 3.0.7 would also work!)

Answer

Tomasz Jakub Rup picture Tomasz Jakub Rup · Nov 12, 2015

You probably try to build from default Command Prompt. This does not work.

You must prepare a Command Prompt. I used the following command to get a commandline with the right settings:

C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /RELEASE /x64

You could create a new shortcut on the desktop, so that you do not have to type it when you want to install a new python modules.

Now You can run a new Command Prompt and build a Python packages.