Python Runtime Initialization error
There is an error occurring during the initialization of the python coupling, on runtime. Python cannot seem to find the 'sys' module, which should be built-in, on Arch Linux. I am trying to read the simulation parameters from the Python script, and also use it to save performance results.
Here is the runtime error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'sys' is not defined
Error while initializing Python
Fatal error came from /home/joao/repos/walberla/src/python_coupling/Manager.cpp:123
Aborting now ...
Stack backtrace:
Backtrace:
./GPU_LBM walberla::debug::printStacktrace(std::ostream&)
./GPU_LBM walberla::Abort::defaultAbort(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, bool)
./GPU_LBM walberla::Abort::abort(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)
./GPU_LBM walberla::python_coupling::Manager::triggerInitialization()
./GPU_LBM
./GPU_LBM walberla::python_coupling::importModuleOrFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)
./GPU_LBM walberla::python_coupling::createConfigIteratorFromPythonScript(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)
./GPU_LBM walberla::python_coupling::configBegin(int, char**)
./GPU_LBM main
/usr/lib/libc.so.6 __libc_start_main
./GPU_LBM _start
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 1.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
Same error occurs with a simpler example:
#include "python_coupling/all.h"
#include "core/config/Config.h"
#include "core/Environment.h"
#include "core/mpi/Environment.h"
#include <string>
using namespace walberla;
int main(int argc, char ** argv)
{
mpi::Environment env( argc, argv );
for( auto configIter = walberla::python_coupling::configBegin(argc, argv);
configIter != walberla::python_coupling::::configEnd();
++configIter )
{
shared_ptr< Config > config = *configIter;
std::string testcase = config->getParameter< std::string >( "testcase", "" );
std::string scenario = config->getParameter< std::string >( "scenario", "" );
}
return 0;
}
And the following Python script:
import waLBerla as wlb
scenarios = wlb.ScenarioManager()
scenarios.add({ "testcase" : "Simulation", "scenario" : "test_performance" })
Compiler and software versions are:
- gcc 7.2.0
- boost 1.65.1
- openmpi 2.1.1
- python 3.6m
Any help would be appreciated.
EDIT: The error still happens with other compilers, tested with GCC 5, GCC 6, and Clang 3.9. So I assume is probably something related to Python or Boost.