peterridolfi / Pyhf-to-Combine-converter

Tool to convert models from pyhf to CMS Combine and vise versa
MIT License
7 stars 1 forks source link

import order causes numpy/core/getlimits.py to throw UserWarning in cmssw-11.2.0-python3 Docker image #30

Open matthewfeickert opened 2 years ago

matthewfeickert commented 2 years ago

This Issue is just to note strange behavior of imports.

In the pyhf/pyhf-combine-converter:cmssw-11.2.0-python3 Docker image environment, if uproot is imported before pyhf then it will cause numpy/core/getlimits.py to throw UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero. and UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.

$ docker run \
    --rm \
    -ti \
    -P \
    --device /dev/fuse \
    --cap-add SYS_ADMIN \
    --security-opt apparmor:unconfined \
    -e CVMFS_MOUNTS="cms.cern.ch oasis.opensciencegrid.org" \
    pyhf/pyhf-combine-converter:cmssw-11.2.0-python3
MY_UID variable not specified, defaulting to cmsusr user id (1000)
MY_GID variable not specified, defaulting to cmsusr user group id (1000)
Mounting the filesystem "cms.cern.ch" ... DONE
Mounting the filesystem "oasis.opensciencegrid.org" ... DONE
Checking CVMFS mounts ... DONE
    The following CVMFS folders have been successfully mounted:
        cms.cern.ch
        oasis.opensciencegrid.org

# Sourcing cmsenv ... DONE
[cmsusr@c6670a9ee98e workarea]$ python3 --version 
Python 3.8.2
[cmsusr@c6670a9ee98e workarea]$ python3 -m pip list | grep 'numpy\|uproot\|pyhf'
numpy                              1.22.4
pyhf                               0.6.3
root-numpy                         4.8.0
uproot                             4.2.3
uproot-methods                     0.8.0
uproot4                            0.1.2
[cmsusr@c6670a9ee98e workarea]$ python3 -c 'import uproot; import pyhf'
/home/cmsusr/.local/lib/python3.8/site-packages/numpy/core/getlimits.py:499: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/cmsusr/.local/lib/python3.8/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
/home/cmsusr/.local/lib/python3.8/site-packages/numpy/core/getlimits.py:499: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/cmsusr/.local/lib/python3.8/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
[cmsusr@c6670a9ee98e workarea]$ python3 -c 'import pyhf; import uproot'
[cmsusr@c6670a9ee98e workarea]$ python3 -c 'import uproot; import numpy'
[cmsusr@c6670a9ee98e workarea]$ 
matthewfeickert commented 2 years ago

I think this unfortunately means that something in the environment is causing the following issue: https://moyix.blogspot.com/2022/09/someones-been-messing-with-my-subnormals.html