Skip to content

[Build Issue] Hadronic modules (SOPHIA/EPOS/Sibyll) missing in Python bindings despite successful build (GCC 15 / Conda) #532

@GeovannaMM

Description

@GeovannaMM

Dear developers,

I downloaded crpropa 3.2.1 as recommended in a previous email from you, but it didn't come complete (with the hadronic models). I tried downloading it with AI help, but it didn't work. I'll explain what I've done so far:

I am trying to compile CRPropa3 with hadronic interaction support (SOPHIA, EPOS, etc.) on a modern Linux environment using Conda, but the Python module does not expose these classes after a successful installation.

Environment:

  • OS: Ubuntu (via Conda environment)
  • Compiler: GCC/G++ 15.2.0 and GFortran 13.3.0 (provided by Conda Forge)
  • Python: 3.12 (also tried downgrading NumPy to 1.26 to avoid API errors)
  • SWIG: Installed via Conda

The Problem:
The compilation reaches 100%. The build logs confirm that the underlying libraries are built:
[ 9%] Built target sophia
[ 100%] Built target crpropa-swig

However, inside Python, the hadronic modules are missing:

import crpropa
hasattr(crpropa, 'SOPHIA') # Returns False
hasattr(crpropa, 'EPOS')   # Returns False

Other modules like MagneticLens or AdiabaticCooling are present and working.

What I have tried:

    Explicitly defining paths for Python, NumPy, and ZLIB in CMake.

    Manually forcing the preprocessor definitions via CXX flags: cmake .. -DCMAKE_CXX_FLAGS="-DCRPROPA_HAVE_EPOS" Result: CMake warns that "Manually-specified variables were not used", and the modules remain missing in Python.

    Manually copying _crpropa.so and crpropa.py to site-packages to ensure I'm loading the correct build.

Suspect: It seems SWIG is not picking up the  definitions during the wrapper generation, possibly due to a mismatch between GCC 15 and GFortran 13, or CMake failing to propagate the flags to the SWIG interface target.

Any guidance on how to force the Python bindings to include the hadronic modules would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions