Closed arunpersaud closed 1 month ago
Thanks for reporting this issue.
In the above case, could you let us know how you setup the environment and installed dependencies for WarpX?
Did you follow one of the instructions sets here?
https://warpx.readthedocs.io/en/latest/install/dependencies.html#install-dependencies
Ah, I see now that you mentioned you used brew
. I think that we need to update the installation instructions with brew
.
Would you be able to try installing the dependencies with conda
or spack
?
Thanks for the report @arunpersaud and @RemiLehe for the guidance.
@arunpersaud do you prefer changing WarpX C++ code and compiling that ("developer" install) or do you like to use WarpX and extend it solely with input files and Python workflows ("user" install)? In the latter case, using our pre-compiled conda packages is the fastest way to success: https://warpx.readthedocs.io/en/latest/install/users.html
You currently picked the developer install. From the error, I think your XCode package on macOS needs an update - likely because of a macOS operating system update (e.g., macOS 12 to 13 or 14) since XCode was first installed.
After the update of XCode, it is also likely that your brew needs an update (as in: needs to be removed and re-installed), because as a user-level package manager it cannot "realize" its underlying OS changed.
After the update, remove rm -rf build
to reconfigure with CMake.
For macOS and brew, here are a few general macOS hints: https://warpx.readthedocs.io/en/latest/install/users.html#tips-for-macos-users and if you like we could do a quick zoom to check if your less-used brew instructions are still up to date: https://warpx.readthedocs.io/en/latest/install/dependencies.html#brew-macos-linux If you prefer brew, I am happy to get this working in brew with you.
Related issues: We fixed issues on SUSE Linux, which had multiple Python versions installed in the system root path. The best solution is to use a Python venv, e.g.,
python3 -m venv $HOME/venvs/warpx-cpu
source $HOME/venvs/warpx-cpu
and have it active to compile, pip install and run to have exactly one Python narrowed down for usage.
The alternative for a system-wide install with multiple system-wide Python versions is to set a CMake hint:
https://cmake.org/cmake/help/latest/module/FindPython.html#hints
Python_ROOT_DIR
only works if the Pythons have a distinct install path, Python_FIND_STRATEGY=VERSION
might be a way to go. But I would recommend using a Conda environment or at least venv instead.
We still try to find out what the XCode/Apple Developer SDK/Brew interaction is that is broken on the mac system. Looks like the developer SDK is out of sync (14.4 on a 14.6 system) or so.
Something like https://stackoverflow.com/a/78664080/2719194
Just to confirm that the venv solution worked. One step I had to do for WarpX to compile was pip install wheel
inside the venv.
We also got it to run by setting -DPython_EXECUTABLE to the correct version (which on my system had to be the same one that python3 points to, which was python3.11). Setting the exectuable to the path of python3.12 did not work and cmake tried to use python3.11 in some places.
looked a bit more into this and the problem seems to be that
include(${WarpX_SOURCE_DIR}/cmake/dependencies/pybind11.cmake)
looks for python3, which on my computer points to 3.11 and not 3.12 and this doesn't take into account python_EXECUTABLE.
One solution is to add
set(PYBIND11_PYTHON_VERSION 3.12 CACHE STRING "")
before the above include call and setting the python_EXECUTABLE to 3.12
Then limiting from the command line via -DPYBIND11_PYTHON_VERSION=3.12
could work, too.
You are right, Python_EXECUTABLE
is not a hint to the FindPython.cmake module anymore, which we use here. I will update the docs.
just confirming that -DPYBIND11_PYTHON_VERSION=3.12 works on my linux box. The full cmake command to configure the build that I used was:
cmake -S . -B build_py -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON -DPython_EXECUTBALE=/usr/bin/python3.12 -DPYBIND11_PYTHON_VERSION=3.12
Note: Typo -DPython_EXECUTBALE
should be -DPython_EXECUTABLE
https://cmake.org/cmake/help/v3.30/module/FindPython.html#artifacts-specification
@arunpersaud I think I found a robust fix for your issue via PR #5390
The regular https://cmake.org/cmake/help/latest/module/FindPython.html logic will now apply and in particular you can set these hints to select a Python prefix path location and these options if multiple are present at the same path/location.
Examples:
cmake -S . -B build_py -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON -DPython_ROOT_DIR=/usr -DPython_FIND_STRATEGY=LOCATION
or
cmake -S . -B build_py -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON -DPython_FIND_VERSION=3.12.6 -DPython_FIND_VERSION_EXACT=TRUE
and/or combinations of these.
As before: If you are in a venv or conda
environment, the Python present in that one will be taken by default, which is the most robust way to build (because you want to install WarpX/ImpactX as a Python package too and be sure they are well matched to the python you use to run your scripts).
I'm using a M1 mac with most packages installed via brew (including python).
I'm trying to follow the cmake instructions from https://warpx.readthedocs.io/en/latest/install/users.html.
I tried this both on the 24.08 tag and the latest git commit (3dda26f)
Creating the build files seems to work:
But when I try to compile it, I run into errors:
I also see errors in regards to, , and .
Is this a problem when creating the build scripts or just some issue with my CC-compiler not knowing the path to these files (which seems odd to me)?
Let me know if I should upload any more files or logs.