Skip to content

DeprecationWarning triggered with Numpy 1.24.0 usage of np.bool8 #6110

@johnthagen

Description

@johnthagen

Environment information (required)

Diagnostics

Diagnostics output
--- check: autoidentify
INFO: diagnose_tensorboard.py version 2dddce2c4b2b32835814022bf9f671da00df13c2

--- check: general
INFO: sys.version_info: sys.version_info(major=3, minor=10, micro=8, releaselevel='final', serial=0)
INFO: os.name: posix
INFO: os.uname(): posix.uname_result(sysname='Darwin', nodename='gpvpn-10-134-244-17.jhuapl.edu', release='21.6.0', version='Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64', machine='x86_64')
INFO: sys.getwindowsversion(): N/A

--- check: package_management
INFO: has conda-meta: False

--- check: installed_packages
INFO: installed: tensorboard==2.11.0
WARNING: no installation among: ['tensorflow', 'tensorflow-gpu', 'tf-nightly', 'tf-nightly-2.0-preview', 'tf-nightly-gpu', 'tf-nightly-gpu-2.0-preview']
INFO: installed: tensorflow-estimator==2.11.0
INFO: installed: tensorboard-data-server==0.6.1

--- check: tensorboard_python_version
INFO: tensorboard.version.VERSION: '2.11.0'

--- check: tensorflow_python_version
2022-12-19 08:12:02.400360: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
INFO: tensorflow.__version__: '2.11.0'
INFO: tensorflow.__git_version__: 'v2.11.0-rc2-17-gd5b57ca93e5'

--- check: tensorboard_data_server_version
INFO: data server binary: '/Users/user/Library/Caches/pypoetry/virtualenvs/proc-server-6ig4-MWI-py3.10/lib/python3.10/site-packages/tensorboard_data_server/bin/server'
INFO: data server binary version: b'rustboard 0.6.1'

--- check: readable_fqdn
INFO: socket.getfqdn(): 'gpvpn-10-134-244-17.jhuapl.edu'

--- check: stat_tensorboardinfo
INFO: directory: /var/folders/vt/p198hmr51x3dvl179df9pdhh0000gn/T/.tensorboard-info
INFO: .tensorboard-info directory does not exist

--- check: full_pip_freeze
INFO: pip freeze --all:
absl-py==1.3.0
anyio==3.6.2
argcomplete==2.0.0
astunparse==1.6.3
attrs==22.1.0
autoflake==1.7.8
black==22.12.0
cachetools==5.2.0
certifi==2022.12.7
charset-normalizer==2.1.1
click==8.1.3
colorama==0.4.6
colorlog==6.7.0
commonmark==0.9.1
coverage==7.0.0
distlib==0.3.6
docker==6.0.1
exceptiongroup==1.0.4
execnet==1.9.0
fastapi==0.88.0
filelock==3.8.2
flake8==5.0.4
flake8-broken-line==0.6.0
flake8-bugbear==22.12.6
flake8-comprehensions==3.10.1
Flake8-pyproject==1.2.2
flatbuffers==22.12.6
gast==0.4.0
ghp-import==2.1.0
google-auth==2.15.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
griffe==0.25.0
grpcio==1.51.1
h11==0.14.0
h5py==3.7.0
httpcore==0.16.2
httptools==0.5.0
httpx==0.23.1
idna==3.4
imageio==2.23.0
importlib-metadata==5.2.0
iniconfig==1.1.1
isort==5.11.3
Jinja2==3.1.2
keras==2.11.0
libclang==14.0.6
Markdown==3.4.1
MarkupSafe==2.1.1
mccabe==0.7.0
mergedeep==1.3.4
mkdocs==1.3.0
mkdocs-autorefs==0.4.1
mkdocs-include-markdown-plugin==4.0.3
mkdocs-material==8.5.4
mkdocs-material-extensions==1.1.1
mkdocstrings==0.19.1
mkdocstrings-python==0.8.2
mypy==0.991
mypy-extensions==0.4.3
networkx==2.8.8
nox==2022.11.21
nox-poetry==1.0.2
numpy==1.24.0
oauthlib==3.2.2
openapi-python-client==0.12.3
opencv-python-headless==4.5.5.64
opt-einsum==3.3.0
packaging==22.0
pandas==1.5.2
pathspec==0.10.3
pep8-naming==0.13.2
Pillow==9.3.0
pip==22.3.1
platformdirs==2.6.0
plotly==5.11.0
pluggy==1.0.0
protobuf==3.19.6
psutil==5.9.4
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycodestyle==2.9.1
pydantic==1.10.2
pyflakes==2.5.0
Pygments==2.13.0
pymdown-extensions==9.9
pytest==7.2.0
pytest-cov==4.0.0
pytest-mock==3.10.0
pytest-randomly==3.12.0
pytest-xdist==3.1.0
python-dateutil==2.8.2
python-dotenv==0.21.0
pytz==2022.7
PyWavelets==1.4.1
PyYAML==6.0
pyyaml_env_tag==0.1
requests==2.28.1
requests-oauthlib==1.3.1
rfc3986==1.5.0
rich==12.6.0
rsa==4.9
scikit-image==0.19.3
scipy==1.9.3
setuptools==65.6.3
shellingham==1.5.0
six==1.16.0
sniffio==1.3.0
starlette==0.22.0
tenacity==8.1.0
tensorboard==2.11.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow-cpu==2.11.0
tensorflow-estimator==2.11.0
tensorflow-io-gcs-filesystem==0.29.0
termcolor==2.1.1
tifffile==2022.10.10
tomli==2.0.1
tomlkit==0.11.6
typer==0.7.0
types-requests==2.28.11.5
types-urllib3==1.26.25.4
typing_extensions==4.4.0
urllib3==1.26.13
uvicorn==0.20.0
uvloop==0.17.0
virtualenv==20.17.1
watchdog==2.2.0
watchfiles==0.18.1
websocket-client==1.4.2
websockets==10.4
Werkzeug==2.2.2
wheel==0.38.4
wrapt==1.14.1
zipp==3.11.0

Issue description

Numpy 1.24.0 deprecated a number of dtypes:

But bool8 is still used:

This leads to DeprecationWarnings being thrown when using this package:

    import tensorflow.lite as tflite
.nox/test-3-10/lib/python3.10/site-packages/tensorflow/__init__.py:51: in <module>
    from ._api.v2 import compat
.nox/test-3-10/lib/python3.10/site-packages/tensorflow/_api/v2/compat/__init__.py:37: in <module>
    from . import v1
.nox/test-3-10/lib/python3.10/site-packages/tensorflow/_api/v2/compat/v1/__init__.py:30: in <module>
    from . import compat
.nox/test-3-10/lib/python3.10/site-packages/tensorflow/_api/v2/compat/v1/compat/__init__.py:38: in <module>
    from . import v2
.nox/test-3-10/lib/python3.10/site-packages/tensorflow/_api/v2/compat/v1/compat/v2/__init__.py:28: in <module>
    from tensorflow._api.v2.compat.v2 import __internal__
.nox/test-3-10/lib/python3.10/site-packages/tensorflow/_api/v2/compat/v2/__init__.py:33: in <module>
    from . import compat
.nox/test-3-10/lib/python3.10/site-packages/tensorflow/_api/v2/compat/v2/compat/__init__.py:38: in <module>
    from . import v2
.nox/test-3-10/lib/python3.10/site-packages/tensorflow/_api/v2/compat/v2/compat/v2/__init__.py:329: in <module>
    from tensorboard.summary._tf import summary
.nox/test-3-10/lib/python3.10/site-packages/tensorboard/summary/__init__.py:22: in <module>
    from tensorboard.summary import v1  # noqa: F401
.nox/test-3-10/lib/python3.10/site-packages/tensorboard/summary/v1.py:23: in <module>
    from tensorboard.plugins.histogram import summary as _histogram_summary
.nox/test-3-10/lib/python3.10/site-packages/tensorboard/plugins/histogram/summary.py:35: in <module>
    from tensorboard.plugins.histogram import summary_v2
.nox/test-3-10/lib/python3.10/site-packages/tensorboard/plugins/histogram/summary_v2.py:35: in <module>
    from tensorboard.util import tensor_util
.nox/test-3-10/lib/python3.10/site-packages/tensorboard/util/tensor_util.py:20: in <module>
    from tensorboard.compat.tensorflow_stub import dtypes, compat, tensor_shape
.nox/test-3-10/lib/python3.10/site-packages/tensorboard/compat/tensorflow_stub/__init__.py:22: in <module>
    from .dtypes import as_dtype  # noqa
.nox/test-3-10/lib/python3.10/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:326: in <module>
    np.bool8: (False, True),
.nox/test-3-10/lib/python3.10/site-packages/numpy/__init__.py:260: in __getattr__
    warnings.warn(msg, DeprecationWarning, stacklevel=2)
E   DeprecationWarning: `np.bool8` is a deprecated alias for `np.bool_`.  (Deprecated NumPy 1.24)

See also, as an example mitigation:

The suggestion seems to be to replace np.bool8 with np.bool_.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions