Skip to content

spack install warpx +python does not install the python bindings #5847

Open
@Noerr

Description

@Noerr

Description

The WarpX Python bindings are not being installed when following the current installation instructions on a fresh system and fresh Spack install. Upon troubleshooting investigation, I find that the pywarpx python module is created in the spack stage directory during the build phase. For unknown reason, the module site-packages is not copied along with other components of WarpX to the spack package installation path.
Precursor python modules such as amrex and mpi4py are correctly installed by spack.

Expected behavior

I expect the following command sequence to work without error.

git clone -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git
. ~/spack/share/spack/setup-env.sh

spack mirror add rolling https://binaries.spack.io/develop

spack install warpx +python

spack load warpx +python

which python3
/home/noah/spack/opt/spack/linux-x86_64_v3/python-venv-1.0-2xj2hqgbairakgplt5lx4sgedmtz3n7n/bin/python3

python3
>>> from pywarpx import picmi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pywarpx'

>>> import amrex
>>> #so amrex worked.
>>> quit()

How to reproduce

which warpx.3d.MPI.OMP.DP.PDP.OPMD.FFT.EB.QED
/home/noah/spack/opt/spack/linux-x86_64_v3/warpx-25.04-mifzxpm4ix6e7qy3slrtlvauybc2qhxw/bin/warpx.3d.MPI.OMP.DP.PDP.OPMD.FFT.EB.QED

ls /home/noah/spack/opt/spack/linux-x86_64_v3/warpx-25.04-mifzxpm4ix6e7qy3slrtlvauybc2qhxw/
bin  lib


ls -1 /home/noah/spack/opt/spack/linux-x86_64_v3/warpx-25.04-mifzxpm4ix6e7qy3slrtlvauybc2qhxw/lib
libablastr_1d.so
libablastr_2d.so
libablastr_3d.so
libablastr_rz.so
libwarpx.1d.MPI.OMP.DP.PDP.OPMD.FFT.EB.QED.so
libwarpx.1d.so
libwarpx.2d.MPI.OMP.DP.PDP.OPMD.FFT.EB.QED.so
libwarpx.2d.so
libwarpx.3d.MPI.OMP.DP.PDP.OPMD.FFT.EB.QED.so
libwarpx.3d.so
libwarpx.rz.MPI.OMP.DP.PDP.OPMD.FFT.EB.QED.so
libwarpx.rz.so
warpx_pybind_1d.cpython-312-x86_64-linux-gnu.so
warpx_pybind_2d.cpython-312-x86_64-linux-gnu.so
warpx_pybind_3d.cpython-312-x86_64-linux-gnu.so
warpx_pybind_rz.cpython-312-x86_64-linux-gnu.so

System information

Please check all relevant boxes and provide details.

  • Operating system (name and version):
    • [X ] Linux: i.e., Ubuntu 24.04.2 LTS
  • Version of WarpX: e.g., latest, 25.04.
  • Installation method:
    • Spack
  • Other dependencies: no
  • Computational resources:
    • [X ] MPI: e.g., 2 MPI processes
    • OpenMP: e.g., 2 OpenMP threads
    • [ X] CPU: e.g., 2 CPUs
    • GPU: e.g., 2 GPUs (NVIDIA, AMD, etc.)

Steps taken so far

What troubleshooting steps have you taken so far, and what were the results?

spack find -v warpx
-- linux-ubuntu22.04-x86_64_v3 / [[email protected]](mailto:[email protected]) ---------------------
[[email protected]+app~ascent~catalyst+eb+fft~ipo+lib+mpi+mpithreadmultiple+openpmd+python+python_ipo+qed~qedtablegen~sensei+shared+tprof](mailto:[email protected]+app~ascent~catalyst+eb+fft~ipo+lib+mpi+mpithreadmultiple+openpmd+python+python_ipo+qed~qedtablegen~sensei+shared+tprof) build_system=cmake build_type=Release compute=omp dims:=1,2,3,rz generator=make precision=double


spack uninstall warpx +python
spack install --verbose --keep-stage  --use-buildcache=package:never,dependencies:auto  warpx +python

I see in the verbose build stage output that python pywarpx module is created in
/tmp/noah/spack-stage/spack-stage-warpx-25.04-mifzxpm4ix6e7qy3slrtlvauybc2qhxw/spack-build-mifzxpm/lib/site-packages

Additional information

Manually appending the spack-stage warpx site-packages into PYTHONPATH shows the pywarpx module functions as expected upon very preliminary testing.

python3
Python 3.12.9 (main, Apr 18 2025, 17:14:46) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pywarpx import picmi
>>> simulation = picmi.Simulation(
...     warpx_serialize_initial_conditions=True,
...     verbose=0
... )
>>>  #that looks good.
>>> quit()

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions