Runtime warning on startup in numpy

I am getting this warning on startup:

RuntimeWarning: invalid value encountered in power
  self.resolution = float_to_float(float_conv(10) ** (-self.precision))

Probably related to

Most likely.

By any chance, do you happen to have a complete stack trace ?

That message is all I get on the console. It is a warning, not error, so there is no stack trace.

Here it is in context:

Number of registered modules: 146
/Applications/ RuntimeWarning: invalid value encountered in power
  self.resolution = float_to_float(float_conv(10) ** (-self.precision))
Number of instantiated modules: 146

Is there a file&line number in the application log?

Yes, I included it:


Is there a call stack to see where the problem originates from? If not, then you could add raise Exception() before the referenced line in to raise an exception and get a call stack.

After adding raise Exception(), here is the stack trace. The warning is triggered on import numpy

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Applications/", line 1, in <module>
    import numpy
  File "/Applications/", line 142, in <module>
    from . import add_newdocs
  File "/Applications/", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/Applications/", line 8, in <module>
    from .type_check import *
  File "/Applications/", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/Applications/", line 51, in <module>
    from . import getlimits
  File "/Applications/", line 126, in <module>
    tiny=_f16(2 ** -14))
  File "/Applications/", line 82, in __init__
    raise Exception()

Thank you. There is nothing particularly suspicious in this call stack. Maybe instead of throwing an exception, you could print the call stack and let the execution continue:

import traceback

This way we could see which call stack corresponds to the warning message (there may be several calls without warnings but after one of them the warning message will be printed as well).

We could also print some variables, such as self.eps and self.precision.

Do you have this warning by simply installing the latest nightly version of Slicer, without installing any extensions? There is no such warning on Windows.

Andras, I get this warning with the latest nightly on mac.

@msmolens @jcfr if you can’t reproduce this issue on mac with a nightly after let me know, and I will investigate later as suggested by @lassoan.

FWIW I don’t get this error on my mac local build after upgrading to numpy 1.13.1. (Note: to test new numpy you need to delete it from site-package before rebuilding).

@pieper I get this warning while launching a nightly binary.

@fedorov What is you version of macOS ?

I have the same on macOS Sierra 10.12.5

I also had the warning on Sierra 10.12.5

I have the same issue on El captian 10.11.4

I just noticed that the same warning shows up in the extension builds, but it is treated as an error:

I logged an issue about this


We will be addressing these shortly.


1 Like

This should be addressed by the following PR.

If there are no objections, I will integrate later tonight.

Note: Developer may have to delete NUMPY-* directories before re-configuring.


Fixes integrated in r26337 and r26338

Note that the fix consist in temporarily disabling the warnings.

1 Like