ai-starthon / AI_Starthon2019

60 stars 44 forks source link

keras import error는 어떻게 해야할까요? #222

Open kimdongjin opened 5 years ago

kimdongjin commented 5 years ago

requirements.txt에 keras >=2.2.4 라고 적고서 main.py에 import keras를 하고서 실행을 하면 다음과 같은 에러가 나옵니다... 어떻게 해야할까요...?

/usr/local/lib/python3.5/dist-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters Using TensorFlow backend. /usr/local/lib/python3.5/dist-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)]) /usr/local/lib/python3.5/dist-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)]) /usr/local/lib/python3.5/dist-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)]) /usr/local/lib/python3.5/dist-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)]) /usr/local/lib/python3.5/dist-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)]) /usr/local/lib/python3.5/dist-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)]) Traceback (most recent call last): File "main.py", line 11, in import keras File "/usr/local/lib/python3.5/dist-packages/keras/init.py", line 3, in from . import utils File "/usr/local/lib/python3.5/dist-packages/keras/utils/init.py", line 6, in from . import conv_utils File "/usr/local/lib/python3.5/dist-packages/keras/utils/conv_utils.py", line 9, in from .. import backend as K File "/usr/local/lib/python3.5/dist-packages/keras/backend/init.py", line 89, in from .tensorflow_backend import * File "/usr/local/lib/python3.5/dist-packages/keras/backend/tensorflow_backend.py", line 5, in import tensorflow as tf File "/usr/local/lib/python3.5/dist-packages/tensorflow/init.py", line 28, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/init.py", line 83, in from tensorflow.python import keras File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/init.py", line 26, in from tensorflow.python.keras import activations File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/activations/init.py", line 22, in from tensorflow.python.keras._impl.keras.activations import elu File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/_impl/keras/init.py", line 21, in from tensorflow.python.keras._impl.keras import activations File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/_impl/keras/activations.py", line 23, in from tensorflow.python.keras._impl.keras import backend as K File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/_impl/keras/backend.py", line 36, in from tensorflow.python.layers import base as tf_base_layers File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/layers/base.py", line 25, in from tensorflow.python.keras import backend File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/backend/init.py", line 22, in from tensorflow.python.keras._impl.keras.backend import abs ImportError: cannot import name 'abs' User session exited

nsml-admin commented 5 years ago

안녕하세요.

에러메세지만 봐서는 keras가 제대로 설치가 안된것같은데요,

직접도커 이미지를 빌드해서 사용하시거나 아니면 기본 이미지중 keras가 설치된 도커이미지를 사용해보시기 바랍니다.(https://nipa.nsml.navercorp.com/support)

에러가 발생했던 세션네임을 알려주시면 좀더 자세한 분석이 가능할것같습니다.

kimdongjin commented 5 years ago

세션 이름은 team_32/2_cls_crane1/360 입니다. 감사합니다.

nsml-admin commented 5 years ago

환경설정이 제대로 안되어서 발생한 에러 같습니다.

해당부분은 유저가 해결해야할 문제로 저희가 도와드리기에는 한계가있어보입니다.

제가권장드리는방법은 윗 댓글에도 말씀드린것처럼 다른도커이미지를 사용하거나 NSML도커 이미지를 사용하는것 입니다.

감사합니다

kimdongjin commented 5 years ago

답변 감사합니다... NSML 도커이미지를 사용하고 싶으면, setup.py를 다음과 같이 구성하면 되는 것 아닌가요? 첫번째줄에 #nsml: nsml/ml:cuda9.0-cudnn7-tf-1.11torch1.0keras2.2 이렇게 적으면 되는것 아닌지요..?

nsml: nsml/ml:cuda9.0-cudnn7-tf-1.11torch1.0keras2.2

from distutils.core import setup

setup( name='Crane1_NSML_Baseline', version='1', description='Crane1_NSML_Baseline', install_requires=[ 'imageio' ] )

nsml-admin commented 5 years ago

네 맞습니다. 위와 같이 하면 될듯합니다.