Skip to content

UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero. #189

Description

@ezio-melotti

I've been seeing these warnings whenever I restart Flask:

flask-app_1      | /usr/local/lib/python3.9/dist-packages/numpy/core/getlimits.py:499: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
flask-app_1      |   setattr(self, word, getattr(machar, word).flat[0])
flask-app_1      | /usr/local/lib/python3.9/dist-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
flask-app_1      |   return self._float_to_str(self.smallest_subnormal)
flask-app_1      | /usr/local/lib/python3.9/dist-packages/numpy/core/getlimits.py:499: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
flask-app_1      |   setattr(self, word, getattr(machar, word).flat[0])
flask-app_1      | /usr/local/lib/python3.9/dist-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
flask-app_1      |   return self._float_to_str(self.smallest_subnormal)

In order to get a traceback, I added this to the top of simoc_server/__init__.py:

import warnings
warnings.filterwarnings("error")

And got this:

flask-app_1      | Traceback (most recent call last):
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/gunicorn/arbiter.py", line 589, in spawn_worker
flask-app_1      |     worker.init_process()
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/gunicorn/workers/ggevent.py", line 146, in init_process
flask-app_1      |     super().init_process()
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/gunicorn/workers/base.py", line 134, in init_process
flask-app_1      |     self.load_wsgi()
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/gunicorn/workers/base.py", line 146, in load_wsgi
flask-app_1      |     self.wsgi = self.app.wsgi()
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/gunicorn/app/base.py", line 67, in wsgi
flask-app_1      |     self.callable = self.load()
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/gunicorn/app/wsgiapp.py", line 58, in load
flask-app_1      |     return self.load_wsgiapp()
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
flask-app_1      |     return util.import_app(self.app_uri)
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/gunicorn/util.py", line 359, in import_app
flask-app_1      |     mod = importlib.import_module(module)
flask-app_1      |   File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
flask-app_1      |     return _bootstrap._gcd_import(name[level:], package, level)
flask-app_1      |   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
flask-app_1      |   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
flask-app_1      |   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
flask-app_1      |   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
flask-app_1      |   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
flask-app_1      |   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
flask-app_1      |   File "/simoc/simoc_server/__init__.py", line 77, in <module>
flask-app_1      |     import simoc_server.views
flask-app_1      |   File "/simoc/simoc_server/views.py", line 25, in <module>
flask-app_1      |     from celery_worker import tasks
flask-app_1      |   File "/simoc/celery_worker/tasks.py", line 16, in <module>
flask-app_1      |     from simoc_server.game_runner import GameRunnerManager
flask-app_1      |   File "/simoc/simoc_server/game_runner.py", line 9, in <module>
flask-app_1      |     from agent_model import (AgentModel)
flask-app_1      |   File "/simoc/agent_model/__init__.py", line 1, in <module>
flask-app_1      |     from .agent_model import (AgentModel)
flask-app_1      |   File "/simoc/agent_model/agent_model.py", line 13, in <module>
flask-app_1      |     from agent_model.initializer import AgentModelInitializer
flask-app_1      |   File "/simoc/agent_model/initializer.py", line 7, in <module>
flask-app_1      |     from agent_model.parse_data_files import parse_currency_desc, parse_agent_desc, \
flask-app_1      |   File "/simoc/agent_model/parse_data_files.py", line 7, in <module>
flask-app_1      |     from agent_model.agents import growth_func
flask-app_1      |   File "/simoc/agent_model/agents/__init__.py", line 1, in <module>
flask-app_1      |     from agent_model.agents.core import BaseAgent, GeneralAgent, StorageAgent, \
flask-app_1      |   File "/simoc/agent_model/agents/core.py", line 15, in <module>
flask-app_1      |     from agent_model.agents import growth_func, variation_func
flask-app_1      |   File "/simoc/agent_model/agents/growth_func.py", line 4, in <module>
flask-app_1      |     from scipy.stats import norm
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/scipy/stats/__init__.py", line 453, in <module>
flask-app_1      |     from ._stats_py import *
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/scipy/stats/_stats_py.py", line 38, in <module>
flask-app_1      |     from scipy.spatial.distance import cdist
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/scipy/spatial/__init__.py", line 107, in <module>
flask-app_1      |     from ._procrustes import procrustes
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/scipy/spatial/_procrustes.py", line 9, in <module>
flask-app_1      |     from scipy.linalg import orthogonal_procrustes
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/scipy/linalg/__init__.py", line 208, in <module>
flask-app_1      |     from ._decomp_schur import *
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/scipy/linalg/_decomp_schur.py", line 178, in <module>
flask-app_1      |     eps = numpy.finfo(float).eps
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/numpy/core/getlimits.py", line 485, in __new__
flask-app_1      |     obj = object.__new__(cls)._init(dtype)
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/numpy/core/getlimits.py", line 499, in _init
flask-app_1      |     setattr(self, word, getattr(machar, word).flat[0])
flask-app_1      |   File "/usr/local/lib/python3.9/dist-packages/numpy/core/getlimits.py", line 80, in smallest_subnormal
flask-app_1      |     warnings.warn(
flask-app_1      | UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.

Everything seems to happen at import time, so It might not be our fault. We are currently using numpy 1.22.4 and celery 5.2.7, and there are some similar reports (e.g. DataDog/dd-trace-py#3394). It might be celery's fault.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions