Visual Studio file can't be found from pip install command

Steven Buechele 0 Reputation points
2024-03-11T15:35:39.1166667+00:00

I'm trying to install 'lws' using pip, but when I run "pip install lws" I get an error, saying
lws.bycython.cpp(196): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory

"

lws.bycython.cpp(196): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory

"

The full output is listed below.

I uninstalled Visual Studio 2022 after uninstalling all of its workloads. After that I got the error "Microsoft Visual C++ 14.0 or greater is required"

After reinstalling Visual Studio 2022 and the I received the Visual Studio Build Tools I received the error again,

lws.bycython.cpp(196): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory

  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
```I've looked on my computer and the file "cl.exe" exists right where the error says it should be.  
What more can be done? Perhaps something is messed up in the registry?

The full input/output from both command line and powershell:

PS C:\Users\user> pip install lws

Collecting lws

  Using cached lws-1.2.8.tar.gz (140 kB)

  Preparing metadata (setup.py) ... done

Requirement already satisfied: numpy in c:\users\skeev\appdata\local\programs\python\python311\lib\site-packages (from lws) (1.26.4)

Building wheels for collected packages: lws

  Building wheel for lws (setup.py) ... error

  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.

  │ exit code: 1

  ╰─> [13 lines of output]

```powershell
  running bdist_wheel

  running build

  running build_ext

  building 'lws' extension

  creating build

  creating build\temp.win-amd64-cpython-311

  creating build\temp.win-amd64-cpython-311\Release

  creating build\temp.win-amd64-cpython-311\Release\lwslib

  "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ilwslib/ -IC:\Users\skeev\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\include -IC:\Users\skeev\AppData\Local\Programs\Python\Python311\include -IC:\Users\skeev\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tplws.bycython.cpp /Fobuild\temp.win-amd64-cpython-311\Release\lws.bycython.obj -O3

  cl : Command line warning D9002 : ignoring unknown option '-O3'

  lws.bycython.cpp

  lws.bycython.cpp(196): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory

  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.39.33519\\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 lws

  Running setup.py clean for lws

Failed to build lws

ERROR: Could not build wheels for lws, which is required to install pyproject.toml-based projects
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Steven Buechele 0 Reputation points
    2024-03-11T17:45:46.7+00:00

    I have been able to install it. For future viewers having the same problem, I installed WSL (Linux console environment provided by Windows 11) and installed python3. I ran the command "pip install lws" and it ran fine.

    The error when trying it in windows was that the file "longintrepr.h" was missing. I found that file in the wsl python folder and copied it to my windows folder and it works fine now.

    Copied file from:

    \wsl.localhost\Ubuntu\usr\include\python3.10\longintrepr.h

    Copied file to:

    C:\Windows.old\Users\username\AppData\Local\Programs\Python\Python311

    Hope that helps some people in the future


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.