Установка TensorFlow на ubuntu16.04 и большом количестве предупреждений

Среда: Ubuntu 16.04 / tensorflow 1.14.0/ Python 3.5.3

Я установил TensorFlow с помощью этой команды.

sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl

Это - результат его.

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: The directory '/home/hanbit-o/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/hanbit-o/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting tensorflow==0.7.1 from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl
  Downloading https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl (13.8MB)
Requirement already satisfied, skipping upgrade: wheel in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.7.1) (0.33.4)
Requirement already satisfied, skipping upgrade: protobuf==3.0.0b2 in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.7.1) (3.0.0b2)
Requirement already satisfied, skipping upgrade: six>=1.10.0 in /usr/lib/python2.7/dist-packages (from tensorflow==0.7.1) (1.10.0)
Requirement already satisfied, skipping upgrade: numpy>=1.8.2 in /home/hanbit-o/.local/lib/python2.7/site-packages (from tensorflow==0.7.1) (1.16.4)
Requirement already satisfied, skipping upgrade: setuptools in /usr/lib/python2.7/dist-packages (from protobuf==3.0.0b2->tensorflow==0.7.1) (20.7.0)
Installing collected packages: tensorflow
  Found existing installation: tensorflow 0.7.1
    Uninstalling tensorflow-0.7.1:
      Successfully uninstalled tensorflow-0.7.1
Successfully installed tensorflow-0.7.1

в это время существует предупреждение python2

На самом деле я хочу использовать TensorFlow в python3, я думаю из-за установки TensorFlow в python2. Существует много комментариев по поводу подсказки.

Python 3.5.3 (default, Aug 28 2019, 20:35:32) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
/home/hanbit-o/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:516: 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/hanbit-o/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:517: 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/hanbit-o/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:518: 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/hanbit-o/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:519: 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/hanbit-o/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:520: 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/hanbit-o/.local/lib/python3.5/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_resource = np.dtype([("resource", np.ubyte, 1)])
/home/hanbit-o/.local/lib/python3.5/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: 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/hanbit-o/.local/lib/python3.5/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: 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/hanbit-o/.local/lib/python3.5/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: 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/hanbit-o/.local/lib/python3.5/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: 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/hanbit-o/.local/lib/python3.5/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: 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/hanbit-o/.local/lib/python3.5/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: 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)])
>>> 

и я пытался проигнорировать его.

>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2019-10-09 21:40:31.902027: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-10-09 21:40:31.926393: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3398000000 Hz
2019-10-09 21:40:31.929440: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x42f31d0 executing computations on platform Host. Devices:
2019-10-09 21:40:31.929480: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
>>> sess.run(hello)
]b'Hello, TensorFlow!'
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> sess.run(a+b)
2019-10-09 21:41:28.143676: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
42

Это - работы (?), и почему там большое предупреждение?

0
задан 9 October 2019 в 16:29

1 ответ

Во-первых, для использования tensorflow с python 3 необходимо установить его использование pip3. Если Вы не имеете pip3 установленный, можно установить его использование sudo apt install python3-pip
Затем можно просто установить tensorflow путем выполнения следующей команды pip3 install tensorflow, Вы не должны использовать sudo.

Во-вторых, у Вас есть предупреждения из-за numpy версии, у Вас, вероятно, есть numpy версия (1.17 или 1.15), который не поддерживается версией tensorflow, который Вы установили.
Таким образом для решения этих предупреждений Вы можете:

  • tensorflow 2.0 установки, который хорошо работает с последней версией numpy. Команда pip3 install --upgrade tensoflow

ИЛИ

  • Понизьте numpy до 1.13.3 <=numpy <=1.14.5 и сохраните текущую версию tensorflow. cammand pip3 install nupmpy==1.14

N.B: предупреждения, что Вы имеете, не означают, что Ваша установка перестала работать. Tensorflow хорошо работает, можно просто проигнорировать их, и все будет хорошо работать.

1
ответ дан 22 December 2019 в 00:22

Другие вопросы по тегам:

Похожие вопросы: