fnalacceleratormodeling / synergia2

Synergia is a accelerator modeling and simulation package developped at Fermilab.
Other
8 stars 4 forks source link

Python version mismatch between what cmake finds and what synergia is linked to #112

Closed s-sajid-ali closed 4 months ago

s-sajid-ali commented 1 year ago

Configuring synergia2 (on the devel3 branch) with python-3.11.1 using :

cmake -B (pwd)/build_devel3 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DBUILD_PYTHON_BINDINGS=
ON -DENABLE_KOKKOS_BACKEND=OpenMP -DBUILD_FD_SPACE_CHARGE_SOLVER=ON -DUSE_EXTERNAL_KOKKOS=ON -DGSV=DOUBLE -DSIMPLE_TIMER=ON -DUSE_EXTERNAL_CEREAL=ON -DPython_EXECUTABLE=(whic
h python) &> cmake_devel3_log.txt

results in the output: cmake_devel3_log.txt, which has:

-- Building python bindings
-- Found Python: /Users/sasyed/Documents/packages/spack/var/spack/environments/synergia2/.spack-env/view/bin/python (found version "3.11.1") found components: Interpreter Development Development.Module Development.Embed 

and the cache has:

sasyed@MAC-140753 ~/D/p/s/build_devel3 (devel3)> cat CMakeCache.txt | rg "PYTHON"
BUILD_PYTHON_BINDINGS:BOOL=ON
PYBIND11_FINDPYTHON:BOOL=OFF
PYBIND11_NOPYTHON:BOOL=OFF
PYTHON_INSTALL_DIR:PATH=lib/python3.11/site-packages
SYNERGIA_EXTRA_PYTHON_PATHS:STRING=
PYBIND11_PYTHON_EXECUTABLE_LAST:INTERNAL=/Users/sasyed/Documents/packages/spack/var/spack/environments/synergia2/.spack-env/view/bin/python
PYTHON_IS_DEBUG:INTERNAL=0
PYTHON_MODULE_EXTENSION:INTERNAL=.cpython-311-darwin.so
sasyed@MAC-140753 ~/D/p/s/build_devel3 (devel3)> 

Building with the above configuration shows no python related warnings, but running a basic python test shows:

sasyed@MAC-140753 ~/D/p/s/build_devel3 (devel3)> ctest --verbose -R test_four_momentum.py
UpdateCTestConfiguration  from :/Users/sasyed/Documents/packages/synergia2/build_devel3/DartConfiguration.tcl
UpdateCTestConfiguration  from :/Users/sasyed/Documents/packages/synergia2/build_devel3/DartConfiguration.tcl
Test project /Users/sasyed/Documents/packages/synergia2/build_devel3
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 37
    Start 37: test_four_momentum.py

37: Test command: /Users/sasyed/Documents/packages/spack/var/spack/environments/synergia2/.spack-env/view/bin/mpiexec "-n" "1" "/Users/sasyed/Documents/packages/spack/var/spack/environments/synergia2/.spack-env/view/bin/python" "-m" "pytest" "-vv" "/Users/sasyed/Documents/packages/synergia2/build_devel3/src/synergia/foundation/tests/test_four_momentum.py"
37: Working Directory: /Users/sasyed/Documents/packages/synergia2/build_devel3/src
37: Test timeout computed to be: 10000000
37: ============================= test session starts ==============================
37: platform darwin -- Python 3.11.1, pytest-7.1.3, pluggy-1.0.0 -- /Users/sasyed/Documents/packages/spack/var/spack/environments/synergia2/.spack-env/view/bin/python
37: cachedir: .pytest_cache
37: rootdir: /Users/sasyed/Documents/packages/synergia2/build_devel3/src
37: collecting ... collected 0 items / 1 error
37: 
37: ==================================== ERRORS ====================================
37: _______ ERROR collecting synergia/foundation/tests/test_four_momentum.py _______
37: ImportError while importing test module '/Users/sasyed/Documents/packages/synergia2/build_devel3/src/synergia/foundation/tests/test_four_momentum.py'.
37: Hint: make sure your test modules/packages have valid Python names.
37: Traceback:
37: ../../../spack/var/spack/environments/synergia2/.spack-env/view/lib/python3.11/site-packages/_pytest/python.py:608: in _importtestmodule
37:     mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
37: ../../../spack/var/spack/environments/synergia2/.spack-env/view/lib/python3.11/site-packages/_pytest/pathlib.py:533: in import_path
37:     importlib.import_module(module_name)
37: ../../../spack/var/spack/environments/synergia2/.spack-env/._view/vr5ladzlsoi52cuzq2a4pqwxbznkbvog/lib/python3.11/importlib/__init__.py:126: in import_module
37:     return _bootstrap._gcd_import(name[level:], package, level)
37: <frozen importlib._bootstrap>:1206: in _gcd_import
37:     ???
37: <frozen importlib._bootstrap>:1178: in _find_and_load
37:     ???
37: <frozen importlib._bootstrap>:1149: in _find_and_load_unlocked
37:     ???
37: <frozen importlib._bootstrap>:690: in _load_unlocked
37:     ???
37: ../../../spack/var/spack/environments/synergia2/.spack-env/view/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:168: in exec_module
37:     exec(co, module.__dict__)
37: synergia/foundation/tests/test_four_momentum.py:3: in <module>
37:     from synergia.foundation import Four_momentum
37: synergia/__init__.py:8: in <module>
37:     from . import utils
37: synergia/utils/__init__.py:1: in <module>
37:     from .utils import *
37: E   ImportError: Python version mismatch: module was compiled for Python 3.10, but the interpreter version is incompatible: 3.11.1 (main, Dec 16 2022, 12:19:34) [Clang 15.0.4 ].
37: =========================== short test summary info ============================
37: ERROR synergia/foundation/tests/test_four_momentum.py
37: !!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
37: =============================== 1 error in 0.09s ===============================
1/1 Test #37: test_four_momentum.py ............***Failed    0.24 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.25 sec

The following tests FAILED:
    37 - test_four_momentum.py (Failed)
Errors while running CTest
Output from these tests are in: /Users/sasyed/Documents/packages/synergia2/build_devel3/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
sasyed@MAC-140753 ~/D/p/s/build_devel3 (devel3) [8]> 

with the most concerning output being

ImportError: Python version mismatch: module was compiled for Python 3.10, but the interpreter version is incompatible: 3.11.1 (main, Dec 16 2022, 12:19:34) [Clang 15.0.4 ].
s-sajid-ali commented 4 months ago

Cannot reproduce.