[Python] How to get reboundx installed on my Windows Anaconda?

Discussão em 'Python' iniciado por Stack, Junho 19, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to install Reboundx on my Windows Anaconda, and keep failing. So far I've been using Google and ChatGPT to try and install reboundx, but the final result is the same. I have no experience or knowledge in commands, CLI, Linux and terminals, please assume I am an idiot, any advice is greatly appreciated.

    I've installed C++ via Microsoft Visual Studio Installer, downloading Visual Studio Build Tools 2022 which has C++ on it. However when I try installing Reboundx, I am hit with the error shown below.

    Collecting reboundx
    Using cached reboundx-4.4.1.tar.gz (93 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
    Requirement already satisfied: rebound>=4.0.0 in c:\harrison\anaconda3\lib\site-packages (from reboundx) (4.4.6)
    Building wheels for collected packages: reboundx
    Building wheel for reboundx (pyproject.toml): started
    Building wheel for reboundx (pyproject.toml): finished with status 'error'
    Failed to build reboundx
    Note: you may need to restart the kernel to use updated packages.
    error: subprocess-exited-with-error

    Building wheel for reboundx (pyproject.toml) did not run successfully.
    exit code: 1

    [66 lines of output]
    C:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\setuptools\_distutils\dist.py:289: UserWarning: Unknown distribution option: 'tests_require'
    warnings.warn(msg)
    C:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\setuptools\_distutils\dist.py:289: UserWarning: Unknown distribution option: 'test_suite'
    warnings.warn(msg)
    C:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
    !!

    ********************************************************************************
    Please consider removing the following classifiers in favor of a SPDX license expression:

    License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)

    See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
    ********************************************************************************

    !!
    self._finalize_license_expression()
    running bdist_wheel
    running build
    running build_py
    creating build\lib.win-amd64-cpython-311\reboundx
    copying reboundx\constants.py -> build\lib.win-amd64-cpython-311\reboundx
    copying reboundx\data.py -> build\lib.win-amd64-cpython-311\reboundx
    copying reboundx\extras.py -> build\lib.win-amd64-cpython-311\reboundx
    copying reboundx\params.py -> build\lib.win-amd64-cpython-311\reboundx
    copying reboundx\simulationarchive.py -> build\lib.win-amd64-cpython-311\reboundx
    copying reboundx\testing.py -> build\lib.win-amd64-cpython-311\reboundx
    copying reboundx\tools.py -> build\lib.win-amd64-cpython-311\reboundx
    copying reboundx\__init__.py -> build\lib.win-amd64-cpython-311\reboundx
    running build_ext
    C:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\rebound\__init__.py:58: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
    import pkg_resources
    *** C:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\rebound *** C:\Harrison\Anaconda3\Lib\site-packages/ *** ***
    building 'libreboundx' extension
    creating build\temp.win-amd64-cpython-311\Release\src
    "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DLIBREBOUNDX -Isrc -IC:\Harrison\Anaconda3\include -IC:\Harrison\Anaconda3\Include -IC:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\rebound "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/central_force.c /Fobuild\temp.win-amd64-cpython-311\Release\src\central_force.obj -DREBXGITHASH=ecc53659ede5ab6ebcb37c70deb3c11970992cef -DLIBREBOUNDX -D_GNU_SOURCE
    central_force.c
    "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DLIBREBOUNDX -Isrc -IC:\Harrison\Anaconda3\include -IC:\Harrison\Anaconda3\Include -IC:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\rebound "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/core.c /Fobuild\temp.win-amd64-cpython-311\Release\src\core.obj -DREBXGITHASH=ecc53659ede5ab6ebcb37c70deb3c11970992cef -DLIBREBOUNDX -D_GNU_SOURCE
    core.c
    src/core.c(156): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    src/core.c(266): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    src/core.c(353): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    src/core.c(383): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    src/core.c(446): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    src/core.c(611): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    src/core.c(979): warning C4244: 'function': conversion from 'const double' to 'const int', possible loss of data
    src/core.c(1043): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DLIBREBOUNDX -Isrc -IC:\Harrison\Anaconda3\include -IC:\Harrison\Anaconda3\Include -IC:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\rebound "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/exponential_migration.c /Fobuild\temp.win-amd64-cpython-311\Release\src\exponential_migration.obj -DREBXGITHASH=ecc53659ede5ab6ebcb37c70deb3c11970992cef -DLIBREBOUNDX -D_GNU_SOURCE
    exponential_migration.c
    "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DLIBREBOUNDX -Isrc -IC:\Harrison\Anaconda3\include -IC:\Harrison\Anaconda3\Include -IC:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\rebound "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/gas_damping_timescale.c /Fobuild\temp.win-amd64-cpython-311\Release\src\gas_damping_timescale.obj -DREBXGITHASH=ecc53659ede5ab6ebcb37c70deb3c11970992cef -DLIBREBOUNDX -D_GNU_SOURCE
    gas_damping_timescale.c
    "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DLIBREBOUNDX -Isrc -IC:\Harrison\Anaconda3\include -IC:\Harrison\Anaconda3\Include -IC:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\rebound "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/gas_dynamical_friction.c /Fobuild\temp.win-amd64-cpython-311\Release\src\gas_dynamical_friction.obj -DREBXGITHASH=ecc53659ede5ab6ebcb37c70deb3c11970992cef -DLIBREBOUNDX -D_GNU_SOURCE
    gas_dynamical_friction.c
    C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_math_defines.h(28): warning C4005: 'M_PI': macro redefinition
    C:\Users\harri\AppData\Local\Temp\pip-install-5o9eo1vk\reboundx_77eebda060dc488caba3a57eb14a9dfa\src\reboundx.h(29): note: see previous definition of 'M_PI'
    "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DLIBREBOUNDX -Isrc -IC:\Harrison\Anaconda3\include -IC:\Harrison\Anaconda3\Include -IC:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\rebound "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/gr.c /Fobuild\temp.win-amd64-cpython-311\Release\src\gr.obj -DREBXGITHASH=ecc53659ede5ab6ebcb37c70deb3c11970992cef -DLIBREBOUNDX -D_GNU_SOURCE
    gr.c
    "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DLIBREBOUNDX -Isrc -IC:\Harrison\Anaconda3\include -IC:\Harrison\Anaconda3\Include -IC:\Users\harri\AppData\Local\Temp\pip-build-env-rqb8pk0z\overlay\Lib\site-packages\rebound "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/gr_full.c /Fobuild\temp.win-amd64-cpython-311\Release\src\gr_full.obj -DREBXGITHASH=ecc53659ede5ab6ebcb37c70deb3c11970992cef -DLIBREBOUNDX -D_GNU_SOURCE
    gr_full.c
    src/gr_full.c(63): error C2057: expected constant expression
    src/gr_full.c(63): error C2466: cannot allocate an array of constant size 0
    src/gr_full.c(63): error C2133: 'a_const': unknown size
    src/gr_full.c(185): error C2057: expected constant expression
    src/gr_full.c(185): error C2466: cannot allocate an array of constant size 0
    src/gr_full.c(185): error C2133: 'a_old': unknown size
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.44.35207\\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 reboundx
    ERROR: Could not build wheels for reboundx, which is required to install pyproject.toml-based projects


    ChatGPT summarises the error as "fails while building the C extensions" and "C99 variable-length arrays (VLAs) not being supported by Microsoft Visual C++ (MSVC)", and suggests I use a "POSIX-Compatible Compiler like MinGW or WSL" since MSVC has this issue.

    So far I've tried:


    • Anaconda prompt, pip install reboundx pip install git+https://github.com/dtamayo/reboundx This set of commands pip install rebound --upgrade, git clone https://github.com/dtamayo/reboundx.git, cd reboundx, pip install ., which worked until I did pip install . which brings up a similar error message with the same error


    • Anaconda, Jupyter Notebook, Terminal file I also tried the same instructions and failed with the same error


    • x64 Native Tools Command Prompt for VS 2022 Set of commands CALL "C:\<My file location>\Anaconda3\Scripts\activate.bat", conda activate base, cd %USERPROFILE%\Desktop, git clone https://github.com/dtamayo/reboundx.git, cd reboundx, pip install ., which also worked perfectly until pip install . with the same error

    The only time that I managed to get Reboundx installed was on Windows Subsystem for Linux, but this was a specific scenario: sudo apt update, sudo apt install python3 python3-pip python3-dev build-essential git, sudo apt install python3.12-venv, python3 -m venv venv, source venv/bin/activate, pip install rebound, pip install reboundx,

    This successfully presented

    Collecting reboundx
    Downloading reboundx-4.4.1.tar.gz (93 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 93.9/93.9 kB 1.4 MB/s eta 0:00:00
    Installing build dependencies ... done
    Getting requirements to build wheel ... done
    Preparing metadata (pyproject.toml) ... done
    Requirement already satisfied: rebound>=4.0.0 in ./venv/lib/python3.12/site-packages (from reboundx) (4.4.8)
    Building wheels for collected packages: reboundx
    Building wheel for reboundx (pyproject.toml) ... done
    Created wheel for reboundx: filename=reboundx-4.4.1-cp312-cp312-linux_x86_64.whl size=283486 sha256=d2c8d5f9101bb356e7003a1bdfda7747eb97e7e09b44d59bd8df0a879b77c1d5
    Stored in directory: /home/harri/.cache/pip/wheels/5c/8e/e5/24bab9049a7faf6615b22959683e51b6841f525fe203224a5b
    Successfully built reboundx
    Installing collected packages: reboundx
    Successfully installed reboundx-4.4.1


    However the 2 main caveats to this solutions is that it is in WSL and not Anaconda, and also running in python3 -m venv venv, a Python virtual environment that I think does not install directly into the computer

    Continue reading...

Compartilhe esta Página