[cctbxbb] pyyaml - iotbx.pdb incompatibility

Nathaniel Echols nechols at lbl.gov
Mon Apr 15 22:21:02 PDT 2013


On Mon, Apr 15, 2013 at 8:24 PM, James Stroud <xtald00d at gmail.com> wrote:
> There is a strange incompatibility between pyyaml and iotbx.pdb that depends
> on the order of import. If yaml is imported first, there is no problem. If
> iotbx.pdb is imported first, then importing yaml crashes. This is the yaml
> that comes with enthought python, but I don't think it's using libyaml,
> which is the C implementation. So the yaml, from what I can tell, is pure
> python.
> ...
> Floating-point error (Python and libc call stacks above)
>                 This crash may be due to a problem in any imported
>                 Python module, including modules which are not part
>                 of the cctbx project. To disable the traps leading
>                 to this message, define these environment variables
>                 (e.g. assign the value 1):
>                     BOOST_ADAPTBX_FPE_DEFAULT
>                     BOOST_ADAPTBX_SIGNALS_DEFAULT
>                 This will NOT solve the problem, just mask it, but
>                 may allow you to proceed in case it is not critical.

We're using a feature in Boost that traps certain C++ issues whose
effect might otherwise be undefined.  Some of these wouldn't normally
crash the interpreter, but they are genuinely bugs, and we want to
catch as many as possible in our code.  (There should be relatively
few of these in CCTBX aside from one module in particular, but we do
see this error occasionally in related code such as Phaser or Resolve,
etc.)

The problem, of course, is that it catches bugs in other people's code
too - I had assumed these were all in C/C++, but your example of "inf
* inf" indicates otherwise.  (I realize this probably isn't really a
bug, but that would be the exception.)  We disable the traps entirely
for GUI programs because some of the modules we use for those have the
same effect.  As the error message above implies, you can avoid the
problem by setting those environment variables.  This can be done just
for the CCTBX dispatchers: create a file named
"dispatcher_include_epd.sh" in your build directory containing these
lines:

export BOOST_ADAPTBX_FPE_DEFAULT=1
export BOOST_ADAPTBX_SIGNALS_DEFAULT=1

and run libtbx.refresh, and from now on cctbx.python (or any other
cctbx command) will have the traps disabled.  (But note the warning
above.)  For the record, you can make any other temporary
modifications you wish to the environment using the include mechanism;
this is how we set the paths for various GUI modules in Phenix.  (And
starting next month, also in a subset of CCTBX bundles.)

Is your example more or less what YAML does that triggers the crash?

-Nat


More information about the cctbxbb mailing list