Почему версия tenorflow, которую я использую в своем ноутбуке, отличается от версии, которую я использую в своей среде? - PullRequest
0 голосов
/ 20 февраля 2020

В моей среде установлен тензор потока в подсистеме windows для linux, но я не могу использовать его в своем ноутбуке. Действительно, вот моя версия:

(seg_env) antoi@LAPTOP-UTL8OHHO:/mnt/c/Users/antoi/Documents/Programming/Covent Garden/Segmentation$ pip list | grep tensorflow

tensorflow           2.1.0
tensorflow-estimator 2.1.0
tensorflow-text      2.1.1

Но когда я пытаюсь импортировать ее, у меня есть:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-61-e25dcad80c44> in <module>
      1 # import tensorflow.compat.v2 as tf
      2 # !{sys.executable} -m pip install -q tensorflow-text
----> 3 from tensorflow_text import SentencepieceTokenizer
      4 
      5 get_ipython().system("{sys.executable} -c 'import tensorflow as tf; print(tf.__version__)'")

ModuleNotFoundError: No module named 'tensorflow_text'

Поэтому я пытаюсь установить ее с ноутбука, и она говорит мне, что мой Версия тензорного потока не та, в которой она нуждается:

  Could not find a version that satisfies the requirement tensorflow<2.2,>=2.1.0 (from tensorflow-text) (from versions: 0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0, 1.2.0rc0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.4.1, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.10.1, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.2, 1.12.3, 1.13.0rc0, 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 2.0.0a0, 2.0.0b0, 2.0.0b1)
No matching distribution found for tensorflow<2.2,>=2.1.0 (from tensorflow-text)

Это странно, не так ли? Я думал, что у меня есть tenorflow 2.1.0! Поэтому я попытался импортировать тензор потока2:

import tensorflow.compat.v2 as tf
!{sys.executable} -c 'import tensorflow.compat.v2 as tf; print(tf.__version__)'


/home/antoi/.local/lib/python3.6/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/antoi/.local/lib/python3.6/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/antoi/.local/lib/python3.6/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/antoi/.local/lib/python3.6/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/antoi/.local/lib/python3.6/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/antoi/.local/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_resource = np.dtype([("resource", np.ubyte, 1)])
/home/antoi/.local/lib/python3.6/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/antoi/.local/lib/python3.6/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/antoi/.local/lib/python3.6/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/antoi/.local/lib/python3.6/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/antoi/.local/lib/python3.6/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/antoi/.local/lib/python3.6/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)])
1.14.0

Кажется, у меня есть тензор потока 1.14.0! Так почему же версия tenorflow, которую я использую в своем ноутбуке, отличается от версии, которую я использую в своей среде?

Обновление: когда я запускаю jupyter-notebook со своей средой anaconda, это не

* 1017 от Anaconda. Действительно :
(seg_env3) antoi@LAPTOP-UTL8OHHO:/mnt/c/Users/antoi/Documents/Programming/Covent Garden/Segmentation$ which jupyter
/home/antoi/.local/bin/jupyter
(seg_env3) antoi@LAPTOP-UTL8OHHO:/mnt/c/Users/antoi/Documents/Programming/Covent Garden/Segmentation$ which jupyter-notebook
/home/antoi/.local/bin/jupyter-notebook

Теперь я уверен, что я не пользуюсь ноутбуком Jupyter от Anaconda. Как мне тогда запустить Jupyter's?

1 Ответ

0 голосов
/ 20 февраля 2020

Только что есть решение, не знаю, имеет ли оно отношение к вашему делу или нет. Проблема с блокнотом заключается в том, что он может загружать блокнот версии python по умолчанию. У меня просто была похожая проблема, когда tenorflow 2.0 загружался в мой ноутбук вместо tf 1.1.4. Для этого я должен был создать новую среду с требуемой версией tf и установить jupyter из этой локальной среды. При повторном запуске jupyter из этой среды он работал нормально.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...