LoginSignup
25
13

More than 5 years have passed since last update.

Chainer, Tensorflowライブラリインポート時のnumpy FutureWarningを解決する

Posted at

環境

Anaconda: 4.4.10
numpy: 1.14.3
tensorflow: 1.8.0
chainer: 4.0.0

問題点

2018年5月現在, Winodws上のAnacondaでChainerとTensorflowを導入したところ, ライブラリのimport時に以下の警告が表示された.

>>> import tensorflow as tf
C:\Users\...\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated.
In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
>>>

Chainerのライブラリをインポートしたときも同様.

見た感じh5pyってパッケージがnumpy使ってる部分で警告出してるっぽい.
試しにh5pyをライブラリとして単体でインポートしても同じ警告が出る.
警告はインポート時に出るだけでライブラリ自体は問題なく使えてそうなんだけど, 毎度出てるのも煩わしいし人に貸したとき何コレってなるから何とかしたい.

因みにエラーを吐いてるh5pyのバージョンは2.7.1でした.

解決策

GitHubにIssuesがあった.

解決を確認した方法は以下の2つ.

  • h5pyのバージョンを上げる

pip install h5py==2.8.0rc1

  • numpyのバージョンを下げる.

pip install numpy==1.13.3

どちらかお好みの方法でどうぞ.

蛇足: h5pyって何ぞ

GitHubより.

h5py is a thin, pythonic wrapper around the HDF5, which runs on Python 2.7, and Python 3 (3.4-3.6).

PythonでHDF5を扱うためのラッパーだそう.
HDF5について詳しくはGoogle先生にお尋ねください.

25
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
13