future version of numpy

    가상환경을 만들고, 1.11.0 버전의 텐서플로우를 설치해서인지 테스트로 tensorflow를 실행할 때 numpy 에러가 발생하였다.

    (mrc) [root@nipa2019-0010 mrc] python
    Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) 
    [GCC 7.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tensorflow as tf
    /root/anaconda3/envs/mrc/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: 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)])
    /root/anaconda3/envs/mrc/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: 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)])
    /root/anaconda3/envs/mrc/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: 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)])
    /root/anaconda3/envs/mrc/lib/python3.6/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_quint16 = np.dtype([("quint16", np.uint16, 1)])
    /root/anaconda3/envs/mrc/lib/python3.6/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_qint32 = np.dtype([("qint32", np.int32, 1)])
    /root/anaconda3/envs/mrc/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: 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)])

    이 에러는 설치된 텐서플로우(현재 설치된 버전은 1.11.0)이 세팅된 numpy와 맞지 않아서 이고, numpy의 버전을 낮춰야 되는 문제이다.

     

    pip show numpy

    (mrc) [root@nipa2019-0010 mrc] pip show numpy
    Name: numpy
    Version: 1.18.1
    Summary: NumPy is the fundamental package for array computing with Python.
    Home-page: https://www.numpy.org
    Author: Travis E. Oliphant et al.
    Author-email: None
    License: BSD
    Location: /root/anaconda3/envs/mrc/lib/python3.6/site-packages
    Requires: 
    Required-by: tensorflow, tensorboard, scipy, mkl-random, mkl-fft, Keras-Preprocessing, Keras-Applications, h5py
    

    설치된 numpy는 현재 version이 1.18.1이며, 텐서플로우 1.11에 대응하기 위해서는 numpy 버전이 1.16.4로 했을때 무난이 된 적이 있기에 다운그레이드를 하고자 한다.

     

    우선 pip uninstall numpy로 기존 numpy를 제거한다

    (mrc) [root@nipa2019-0010 mrc] pip uninstall numpy
    Found existing installation: numpy 1.18.1
    Uninstalling numpy-1.18.1:
      Would remove:
        /root/anaconda3/envs/mrc/bin/f2py
        /root/anaconda3/envs/mrc/bin/f2py3
        /root/anaconda3/envs/mrc/bin/f2py3.6
        /root/anaconda3/envs/mrc/lib/python3.6/site-packages/numpy
        /root/anaconda3/envs/mrc/lib/python3.6/site-packages/numpy-1.18.1-py3.6.egg-info
    Proceed (y/n)? y
      Successfully uninstalled numpy-1.18.1

    이후 pip install numpy==1.16.4로 올드한 numpy를 설치한다.

    (mrc) [root@nipa2019-0010 mrc] pip install numpy==1.16.4
    Collecting numpy==1.16.4
      Downloading numpy-1.16.4-cp36-cp36m-manylinux1_x86_64.whl (17.3 MB)
         |████████████████████████████████| 17.3 MB 260 kB/s 
    ERROR: tensorflow 1.11.0 has requirement setuptools<=39.1.0, but you'll have setuptools 47.1.1.post20200604 which is incompatible.
    Installing collected packages: numpy
    Successfully installed numpy-1.16.4
    (mrc) [root@nipa2019-0010 mrc] python
    Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) 
    [GCC 7.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tensorflow as tf
    >>> print(tf.__version__)
    1.11.0

    다운그레이드한 numpy를 실행 후 정상적으로 tensorflow가 import 되는 것을 확인 할 수 있다.

    반응형

    댓글

    Designed by JB FACTORY