D8021: invalid numeric argument '/Wno-unknown-pragmas' for 'pip install rebound'

Mike Landis 41 Reputation points
2023-06-09T18:01:25.27+00:00

I'm using VS-Code on Windows-10 for python 3.11 development. When I try 'pip install rebound', cl.exe throws "D8021: invalid numeric argument '/Wno-unknown-pragmas'". Other posts say the Intel and gcc compilers accept that flag. Should cl.exe be upgraded to deal with it too?

I found the flag in rebound's setup.py. I edited that script to eliminate the flag, but somehow it STILL shows up in the build transcript when 'pip install rebound' runs. How is MY modified setup.py getting ignored? Is the flag actually coming from somewhere else? How can I suppress generation of that compiler flag or maybe convince VS-Code to use gcc instead? What's the best workaround?

For reference, the build transcript follows here...

$ pip install rebound
Collecting rebound
  Using cached rebound-3.25.1.tar.gz (296 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: rebound
  Building wheel for rebound (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for rebound (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [28 lines of output]
      fatal: not a git repository (or any of the parent directories): .git
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\rebound
      copying rebound\citations.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\data.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\horizons.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\interruptible_pool.py -> build\lib.win-amd64-cpython-311\rebound        
      copying rebound\particle.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\plotting.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\simulation.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\simulationarchive.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\tools.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\units.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\widget.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\__init__.py -> build\lib.win-amd64-cpython-311\rebound
      copying rebound\rebound.h -> build\lib.win-amd64-cpython-311\rebound
      running build_ext
      building 'librebound' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DLIBREBOUND -Isrc -IC:\Programs\Python311\include -IC:\Programs\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual 
Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcsrc/binarydiff.c /Fobuild\temp.win-amd64-cpython-311\Release\src/binarydiff.obj -fstrict-aliasing -O3 -std=c99 -Wno-unknown-pragmas -DGITHASH=2a8f0c05527e195cc83a1bc8b0a439b0bf2a4192 -DLIBREBOUND -D_GNU_SOURCE -fPIC
      cl : Command line error D8021 : invalid numeric argument '/Wno-unknown-pragmas'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\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 rebound
Failed to build rebound
ERROR: Could not build wheels for rebound, which is required to install pyproject.toml-based projects

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,681 Reputation points Microsoft External Staff
    2023-06-12T09:55:27.1+00:00

    Hello @Mike Landis ,

    Thank you for taking time to post this issue in Microsoft Q&A forum.

    Since Visual Studio Code is currently not supported in the Microsoft Q&A forums, the supported products are listed over here: https://learn.microsoft.com/en-us/answers/.

    For the related questions(technical support) about VS Code, you can post here: Stack Overflow tagged Visual Studio Code.

    Thanks for your understanding, have a great day.

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

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