NTMC-Community / MatchZoo

Facilitating the design, comparison and sharing of deep text matching models.
Apache License 2.0
3.82k stars 898 forks source link

Add the tensorflow requirements to the install setup #818

Closed thiziri closed 4 years ago

thiziri commented 4 years ago

Describe the bug

Hi MZ team, I've installed the new version of MatchZoo, using the pip install matchzoo comand line. When I run the import command: import matchzoo as mz I've got the following huge error message:

Using TensorFlow backend.

ModuleNotFoundError Traceback (most recent call last)

in ----> 1 import matchzoo as mz C:\ProgramData\Anaconda3\lib\site-packages\matchzoo\__init__.py in 18 from . import tasks 19 ---> 20 from . import preprocessors 21 from . import data_generator 22 from .data_generator import DataGenerator C:\ProgramData\Anaconda3\lib\site-packages\matchzoo\preprocessors\__init__.py in ----> 1 from . import units 2 from .dssm_preprocessor import DSSMPreprocessor 3 from .naive_preprocessor import NaivePreprocessor 4 from .basic_preprocessor import BasicPreprocessor 5 from .cdssm_preprocessor import CDSSMPreprocessor C:\ProgramData\Anaconda3\lib\site-packages\matchzoo\preprocessors\units\__init__.py in 11 from .stemming import Stemming 12 from .stop_removal import StopRemoval ---> 13 from .tokenize import Tokenize 14 from .vocabulary import Vocabulary 15 from .word_hashing import WordHashing C:\ProgramData\Anaconda3\lib\site-packages\matchzoo\preprocessors\units\tokenize.py in 1 import nltk ----> 2 from matchzoo.utils.bert_utils import is_chinese_char, \ 3 whitespace_tokenize, run_split_on_punc 4 5 from .unit import Unit C:\ProgramData\Anaconda3\lib\site-packages\matchzoo\utils\__init__.py in 2 from .tensor_type import TensorType 3 from .list_recursive_subclasses import list_recursive_concrete_subclasses ----> 4 from .make_keras_optimizer_picklable import make_keras_optimizer_picklable C:\ProgramData\Anaconda3\lib\site-packages\matchzoo\utils\make_keras_optimizer_picklable.py in ----> 1 import keras 2 3 4 def make_keras_optimizer_picklable(): 5 """ C:\ProgramData\Anaconda3\lib\site-packages\keras\__init__.py in 1 from __future__ import absolute_import 2 ----> 3 from . import utils 4 from . import activations 5 from . import applications C:\ProgramData\Anaconda3\lib\site-packages\keras\utils\__init__.py in 4 from . import data_utils 5 from . import io_utils ----> 6 from . import conv_utils 7 from . import losses_utils 8 from . import metrics_utils C:\ProgramData\Anaconda3\lib\site-packages\keras\utils\conv_utils.py in 7 from six.moves import range 8 import numpy as np ----> 9 from .. import backend as K 10 11 C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\__init__.py in ----> 1 from .load_backend import epsilon 2 from .load_backend import set_epsilon 3 from .load_backend import floatx 4 from .load_backend import set_floatx 5 from .load_backend import cast_to_floatx C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\load_backend.py in 88 elif _BACKEND == 'tensorflow': 89 sys.stderr.write('Using TensorFlow backend.\n') ---> 90 from .tensorflow_backend import * 91 else: 92 # Try and load external backend. C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in 3 from __future__ import print_function 4 ----> 5 import tensorflow as tf 6 from tensorflow.python.eager import context 7 from tensorflow.python.framework import device as tfdev ModuleNotFoundError: No module named 'tensorflow'

which means that the tensorflow library is not installed by the command pip install matchzoo. Thanks

Describe your attempts

You should also provide code snippets you tried as a workaround, StackOverflow solution that you have walked through, or your best guess of the cause that you can't locate (e.g. cosmic radiation).

Context

bwanglzu commented 4 years ago

hi @thiziri I checked the master branch: image

thiziri commented 4 years ago

Thanks, @bwanglzu for the clarification. In fact, I've just installed it and re-run the pip install matchzoo command, now it's working well. But the latter command alone does not install tensorflow as a requirement.

Since it's solved you can close this issue may be :)

bwanglzu commented 4 years ago

@thiziri good to know, sometimes it's good to use a virtualenv to prepare your dependencies.