갈루아의 반서재

텐서플로우 설치 후 다음과 같은 메시지가 뜨는 경우

(AnnaM) founder@hilbert:~$ python
Python 3.7.4 (default, Aug 13 2019, 20:35:49)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>>
>>> import tensorflow as tf
/home/founder/anaconda3/envs/AnnaM/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/founder/anaconda3/envs/AnnaM/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/founder/anaconda3/envs/AnnaM/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/founder/anaconda3/envs/AnnaM/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/founder/anaconda3/envs/AnnaM/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/founder/anaconda3/envs/AnnaM/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])

일단 위의 메시지는 에러가 아닌 경고 메시지이다. 기존에는 [(name, dtype, 1)] 또는 "1type" 이 스칼라 타입 - 즉, [(name, dtype)] 또는 [(name, dtype, ()] - 으로 다루어졌지만, 1.17 버전에서는 [(name, dtype, (1,))] 또는 "(1,)type" 으로 취급된다는 경고메시지이다. 이와 관련된 내용은 다음 링크에서 찾아볼 수 있다.

https://docs.scipy.org/doc/numpy/release.html#future-changes 

기존에 설치되어 있던 1.17.2 버전을 제거하고 1.16.5 버전을 설치했다.

(AnnaM) founder@hilbert:~$ pip install "numpy<1.17"
Collecting numpy<1.17
  Downloading https://files.pythonhosted.org/packages/98/5b/e1bf225ed4614b6a482ea783f75ce571b0d440ba247f6f52c0b7347d6e18/numpy-1.16.5-cp37-cp37m-manylinux1_x86_64.whl (17.3MB)
     |████████████████████████████████| 17.3MB 2.5MB/s
Installing collected packages: numpy
  Found existing installation: numpy 1.17.2
    Uninstalling numpy-1.17.2:
      Successfully uninstalled numpy-1.17.2
Successfully installed numpy-1.16.5

다시 텐서플로우를 실행해보면 정상적으로 라이브러리를 불러옴을 알 수 있다.

(AnnaM) founder@hilbert:~$ python
Python 3.7.4 (default, Aug 13 2019, 20:35:49)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> exit()

설치된 numpy 버전은 다음과 같이 확인이 가능하다.

(AnnaM) founder@hilbert:~$ pip list
Package              Version
-------------------- ---------
absl-py              0.8.0
astor                0.8.0
certifi              2019.9.11
gast                 0.3.2
grpcio               1.24.0
h5py                 2.10.0
Keras-Applications   1.0.8
Keras-Preprocessing  1.1.0
Markdown             3.1.1
mock                 3.0.5
numpy                1.16.5
pip                  19.2.3
protobuf             3.9.2
setuptools           41.2.0
six                  1.12.0
tensorboard          1.13.1
tensorflow           1.13.1
tensorflow-estimator 1.13.0
termcolor            1.1.0
Werkzeug             0.16.0
wheel                0.33.6

[참고링크] https://stackoverflow.com/questions/57488150/tensorflow-warning-for-data-types

 

tensorflow warning for data types

I have installed tensorflow and numpy in Python 3.7.4 [64-bit]. When I tried importing it, I get the following warning: /home/user/.local/lib/python3.7/site-packages/tensorflow/python/framework/...

stackoverflow.com