10

I'm hoping someone can help me since I've been stuck on this for a while, and I'm not very familiar with compiling packages. Trying to install the following package: https://github.com/jhkorhonen/MOODS/wiki/Installation

Running Python 3.5 (Anaconda), Windows 10 64bit, Microsoft Visual Studio 2017 Community Edition. Here is what I did so far.

  • Error 1:cded to extracted package location, and ran python setup.py install --user but got the error that says:

    running install running build running build_py running build_ext building 'MOODS._tools' extension cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icore/ -IC:\Users\Wolf\Anaconda3\include -IC:\Users\Wolf\Anaconda3\include /EHsc /Tpcore/tools_wrap.cxx /Fobuild\temp.win-amd64-3.5\Release\core/tools_wrap.obj -march=native -O3 -fPIC --std=c++11 error: command 'cl.exe' failed: No such file or directory

  • Solution 1: Turns out C:\Program Files (x86)\Microsoft Visual Studio 14.0 does not have the \VC folder it is looking for, but I did find it at C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\bin, so I added that to PATH.

Then another error:

  • Error 2: C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\bin\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icore/ -IC:\Users\Wolf\Anaconda3\include -IC:\Users\Wolf\Anaconda3\include /EHsc /Tpcore/tools_wrap.cxx /Fobuild\temp.win-amd64-3.5\Release\core/tools_wrap.obj -march=native -O3 -fPIC --std=c++11 cl : Command line warning D9002 : ignoring unknown option '-march=native' cl : Command line warning D9002 : ignoring unknown option '-O3' cl : Command line warning D9002 : ignoring unknown option '-fPIC' cl : Command line warning D9002 : ignoring unknown option '--std=c++11' tools_wrap.cxx c:\users\wolf\anaconda3\include\pyconfig.h(68): fatal error C1083: Cannot open include file: 'io.h': No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\14.0\\VC\\bin\\cl.exe' failed with exit status 2
  • Solution 2: So I added an environmental variable INCLUDE and set it to C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt, which has io.h.

However, yet another error:

C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\bin\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icore/ -IC:\Users\Wolf\Anaconda3\include -IC:\Users\Wolf\Anaconda3\include "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt" /EHsc /Tpcore/tools_wrap.cxx /Fobuild\temp.win-amd64-3.5\Release\core/tools_wrap.obj -march=native -O3 -fPIC --std=c++11 cl : Command line warning D9002 : ignoring unknown option '-march=native' cl : Command line warning D9002 : ignoring unknown option '-O3' cl : Command line warning D9002 : ignoring unknown option '-fPIC' cl : Command line warning D9002 : ignoring unknown option '--std=c++11' tools_wrap.cxx C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt\corecrt.h(10): fatal error C1083: Cannot open include file: 'vcruntime.h': No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\14.0\\VC\\bin\\cl.exe' failed with exit status 2

I'm not sure how to solve this. It seems like adding things to PATH isn't helping a whole lot. Maybe it has to do with the introduction of Universal CRT? Should I just uninstall Visual Studio 2017 and use an older version?

Flow Nuwen
  • 547
  • 5
  • 20
  • About Python, I only know a bit more than diddly, but it looks like you are trying to feed GCC command lines into Visual Studio. I'd check the instructions for the packages again because something has gone seriously wrong. – user4581301 Mar 13 '17 at 06:13

2 Answers2

14

I had very similiar issue running Python 3.5 (Anaconda), Windows 10 64bit, Microsoft Visual Studio 2017 Professional Edition.

Did you try to enable a 64-Bit Visual C++ Toolset on the Command Line? To do this, run vcvars64.bat on your command line first. In my case the localization is:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build

This was sufficient for me and solved my problem.

In addition, I see some users have to install "Windows Universal CRT SDK" (I have it already). Check if you also have it:

  1. Run Visual Studio Installer.
  2. Select Modify button.
  3. Go to "Individual Components" tab.
  4. Scroll down to "Compilers, build tools and runtimes".
  5. Tick "Windows Universal CRT SDK".
  6. Install.

PS: for convenience I recommend using powershell. A script for setting vcvars64.bat example from here:

pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\"
cmd /c "vcvars64.bat&set" |
foreach {
  if ($_ -match "=") {
    $v = $_.split("="); set-item -force -path "ENV:\$($v[0])"  -value "$($v[1])"
  }
}
popd
Write-Host "`nVisual Studio 2017 Command Prompt variables set." -ForegroundColor Yellow
Kamil Czerski
  • 645
  • 9
  • 11
  • Thank you for this script! Worked for me! – Maecky Jul 03 '17 at 14:46
  • I get `File "", line 1 cmd /c "vcvars64.bat&set" | ^ SyntaxError: invalid syntax` I'm right if I execute this code in the Python console right? – Svenno Nito Jan 02 '18 at 16:51
  • no :) this is not python language, it is PowerShell script. Save this script as a file called scirpt_name.ps1 and run it in PowerShell. To run a script, open a PowerShell window, type the script's name (with or without the .ps1 extension) followed by the script's parameters (if any), and press Enter. – Kamil Czerski Jan 04 '18 at 16:55
  • This fixed my problem on Windows 10 using pip to install cvxpy. It need to build something before it could complete its install, and following these instructions worked. – loganjones16 Apr 06 '19 at 23:44
  • I can't use cmd command in powershell and there i no such command in get-command results. Can anybody help me please? Google serch didn't help me. – Oleksii Zhyglov Jan 04 '20 at 16:13
1

you can also download and install window 10 sdk independently,

using this link, hope it solves the issue.

2nd try to use the the visual studio command propmpt e.g Vs2017 x64 Native Tools command prompt and then try the compilation process.

Khan
  • 1,288
  • 12
  • 11