deepmodeling / deepmd-kit

A deep learning package for many-body potential energy representation and molecular dynamics
https://docs.deepmodeling.com/projects/deepmd/
GNU Lesser General Public License v3.0
1.45k stars 499 forks source link

Error run dp on mac #176

Closed zezhong-zhang closed 4 years ago

zezhong-zhang commented 4 years ago

Hi,

I installed deepmd on mac using conda install -c conda-forge deepmd-kit and I can confirm that it is installed using

conda list deepmd
# packages in environment at /Users/Zezhong/anaconda3/envs/atomate:
#
# Name                    Version                   Build  Channel
deepmd-kit                1.1.1            py37h2af55cb_0    conda-forge

The tensorflow is installed with version 2.0.0

conda list tensorflow
# packages in environment at /Users/Zezhong/anaconda3/envs/atomate:
#
# Name                    Version                   Build  Channel
tensorflow                2.0.0           mkl_py37hda344b4_0
tensorflow-base           2.0.0           mkl_py37h66b1bf0_0
tensorflow-estimator      2.0.0              pyh2649769_0

When I ran dp, it has the following error, is it due to the verison of tensorflow? Many thanks for your help.

WARNING:tensorflow:From /Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/tensorflow_core/python/compat/v2_compat.py:65: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
Traceback (most recent call last):
  File "/Users/Zezhong/anaconda3/envs/atomate/bin/dp", line 5, in <module>
    from deepmd.main import main
  File "/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/deepmd/__init__.py", line 2, in <module>
    from .DeepEval   import DeepEval
  File "/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/deepmd/DeepEval.py", line 18, in <module>
    op_module = tf.load_op_library(os.path.join(module_path, "libop_abi.{}".format(ext)))
  File "/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/tensorflow_core/python/framework/load_library.py", line 61, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: dlopen(/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/deepmd/libop_abi.dylib, 6): Library not loaded: @rpath/libtensorflow_framework.so
  Referenced from: /Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/deepmd/libop_abi.dylib
  Reason: image not found
njzjz commented 4 years ago

The conda-forge's deepmd currently only supports tensorflow 1.13.

zezhong-zhang commented 4 years ago

I tried to uninstall the 2.0.0 and reinstall deepmd. then found that the current deepmd in the conda-forge actually specify tensorflow 2.0.0 which makes it unworkable.

`conda install -c conda-forge deepmd-kit

Collecting package metadata (current_repodata.json): done Solving environment: done

==> WARNING: A newer version of conda exists. <== current version: 4.7.12 latest version: 4.8.2

Please update conda by running

$ conda update -n base -c defaults conda

Package Plan

environment location: /Users/Zezhong/anaconda3/envs/atomate

added / updated specs:

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
certifi-2019.11.28         |           py37_0         148 KB  conda-forge
deepmd-kit-1.1.3           |   py37h2af55cb_0         2.0 MB  conda-forge
h5py-2.10.0                |nompi_py37h106b333_102        1015 KB  conda-forge
libcxx-9.0.1               |                1        1011 KB  conda-forge
libprotobuf-3.11.3         |       hd174df1_0         4.5 MB  conda-forge
markdown-3.2               |             py_0          61 KB  conda-forge
protobuf-3.11.3            |   py37h4a8c4bd_0         683 KB  conda-forge
------------------------------------------------------------
                                       Total:         9.3 MB

The following NEW packages will be INSTALLED:

_tflow_select pkgs/main/osx-64::_tflow_select-2.3.0-mkl absl-py conda-forge/osx-64::absl-py-0.9.0-py37_0 astor conda-forge/noarch::astor-0.7.1-py_0 c-ares conda-forge/osx-64::c-ares-1.15.0-h01d97ff_1001 deepmd-kit conda-forge/osx-64::deepmd-kit-1.1.3-py37h2af55cb_0 gast conda-forge/noarch::gast-0.2.2-py_0 google-pasta conda-forge/noarch::google-pasta-0.1.8-py_0 grpcio conda-forge/osx-64::grpcio-1.23.0-py37h8a88325_0 h5py conda-forge/osx-64::h5py-2.10.0-nompi_py37h106b333_102 hdf5 conda-forge/osx-64::hdf5-1.10.5-nompi_h0cbb7df_1103 keras-applications conda-forge/noarch::keras-applications-1.0.8-py_1 keras-preprocessi~ conda-forge/noarch::keras-preprocessing-1.1.0-py_0 libprotobuf conda-forge/osx-64::libprotobuf-3.11.3-hd174df1_0 markdown conda-forge/noarch::markdown-3.2-py_0 opt_einsum conda-forge/noarch::opt_einsum-3.1.0-py_0 protobuf conda-forge/osx-64::protobuf-3.11.3-py37h4a8c4bd_0 tensorboard pkgs/main/noarch::tensorboard-2.0.0-pyhb38c66f_1 tensorflow pkgs/main/osx-64::tensorflow-2.0.0-mkl_py37hda344b4_0 tensorflow-base pkgs/main/osx-64::tensorflow-base-2.0.0-mkl_py37h66b1bf0_0 tensorflow-estima~ pkgs/main/noarch::tensorflow-estimator-2.0.0-pyh2649769_0 termcolor conda-forge/noarch::termcolor-1.1.0-py_2 wrapt conda-forge/osx-64::wrapt-1.11.2-py37h0b31af3_0

The following packages will be UPDATED:

libcxx pkgs/main::libcxx-4.0.1-hcfea43d_1 --> conda-forge::libcxx-9.0.1-1

The following packages will be SUPERSEDED by a higher-priority channel:

ca-certificates pkgs/main::ca-certificates-2020.1.1-0 --> conda-forge::ca-certificates-2019.11.28-hecc5488_0 certifi pkgs/main --> conda-forge `

njzjz commented 4 years ago

I can confirm this issue. You can try conda install deepmd-kit tensorflow=1.13 -c conda-forge to specify the tensorflow version.

The tensorflow version seems to be not pinned... I'll submit a PR to fix it then,

zezhong-zhang commented 4 years ago

Tried conda install deepmd-kit tensorflow=1.13 -c conda-forge, runing dp, I guess it works except has some deprecated warning from tensorflow.

/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/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_qint8 = np.dtype([("qint8", np.int8, 1)])
/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/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_quint8 = np.dtype([("quint8", np.uint8, 1)])
/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:528: 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)])
/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:529: 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)])
/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:530: 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)])
/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:535: 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)])
WARNING:tensorflow:From /Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/tensorflow/python/compat/compat.py:175: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
WARNING:root:Environment variable KMP_BLOCKTIME is empty. Use the default value 0
WARNING:root:Environment variable KMP_AFFINITY is empty. Use the default value granularity=fine,verbose,compact,1,0
usage: dp [-h] {train,freeze,test} ...

DeePMD-kit: A deep learning package for many-body potential energy
representation and molecular dynamics

optional arguments:
  -h, --help           show this help message and exit

Valid subcommands:
  {train,freeze,test}
    train              train a model
    freeze             freeze the model
    test               test the model
Traceback (most recent call last):
  File "/Users/Zezhong/anaconda3/envs/atomate/bin/dp", line 8, in <module>
    sys.exit(main())
  File "/Users/Zezhong/anaconda3/envs/atomate/lib/python3.7/site-packages/deepmd/main.py", line 71, in main
    raise RuntimeError('unknown command ' + args.command)
TypeError: can only concatenate str (not "NoneType") to str
njzjz commented 4 years ago

Just ignore the warning. It has worked well.

zezhong-zhang commented 4 years ago

Thanks!