How to fix fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory

Mahankali, Sai Charan 0 Reputation points
2023-08-21T12:25:06.1933333+00:00

Hi all,

I am trying to install detools package from pypi using "pip install detools"

In the process of installing, initially I got some error regarding the requirement of C++ Build tools as detools contains some c++ extensions need to be compiled. I have installed the build tools as per the documentation.

Now, iam getting the following error logs

  "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Mahanksa\Anaconda3\include -IC:\Users\Mahanksa\Anaconda3\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /Tcdetools/libdivsufsort/divsufsort.c /Fobuild\temp.win-amd64-cpython-39\Release\detools/libdivsufsort/divsufsort.obj
      divsufsort.c
      detools/libdivsufsort/divsufsort.c(5): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for detools
  Running setup.py clean for detools
Failed to build detools
ERROR: Could not build wheels for detools, which is required to install pyproject.toml-based projects

Any help is highly appreciated

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,073 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 45,341 Reputation points
    2023-08-22T07:31:52.98+00:00

    The command prompt shortcuts that are created by the Visual Studio Installer properly configure environment variables for running the command line tools. These variables set paths for C/C++ include files and paths to be searched for libraries.

    I also have the 10.0.20348.0 version of the Windows SDK installed and the "stdio.h" file is provided by the Windows SDK. As a component of the UCRT, it is located at "C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\ucrt\stdio.h".

    So it seems to me that you are probably not using a VS provided command line environment and the CL.exe command line does not provide the path needed for files from the Windows SDK as shown above. At a minimum the CL.exe command line needs /I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\ucrt"


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.