forked from deepmodeling/deepmd-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
83 lines (75 loc) · 3.02 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from skbuild import setup
from skbuild.exceptions import SKBuildError
from skbuild.cmaker import get_cmake_version
from setuptools_scm import get_version
from packaging.version import LegacyVersion
from os import path, makedirs
import os, imp, sys, platform, sysconfig
def get_dp_install_path() :
site_packages_path = sysconfig.get_paths()['purelib']
dp_scm_version = get_version(root=".", relative_to=__file__)
python_version = 'py' + str(sys.version_info.major + sys.version_info.minor * 0.1)
os_info = sys.platform
machine_info = platform.machine()
dp_pip_install_path = os.path.join(site_packages_path, 'deepmd')
dp_setup_install_path = os.path.join(site_packages_path, 'deepmd_kit-' + dp_scm_version + '-' + python_version + '-' + os_info + '-' + machine_info + '.egg', 'deepmd')
return dp_pip_install_path, dp_setup_install_path
readme_file = path.join(path.dirname(path.abspath(__file__)), 'README.md')
try:
from m2r import parse_from_file
readme = parse_from_file(readme_file)
except ImportError:
with open(readme_file) as f:
readme = f.read()
try:
tf_install_dir = imp.find_module('tensorflow')[1]
except ImportError:
site_packages_path = path.join(path.dirname(path.__file__), 'site-packages')
tf_install_dir = imp.find_module('tensorflow', [site_packages_path])[1]
install_requires=['numpy', 'scipy']
setup_requires=['setuptools_scm', 'scikit-build']
# add cmake as a build requirement if cmake>3.0 is not installed
try:
if LegacyVersion(get_cmake_version()) < LegacyVersion("3.0"):
setup_requires.append('cmake')
except SKBuildError:
setup_requires.append('cmake')
try:
makedirs('deepmd')
except OSError:
pass
dp_pip_install_path, dp_setup_install_path = get_dp_install_path()
setup(
name="deepmd-kit",
setup_requires=setup_requires,
use_scm_version={'write_to': 'deepmd/_version.py'},
author="Han Wang",
author_email="[email protected]",
description="A deep learning package for many-body potential energy representation and molecular dynamics",
long_description=readme,
long_description_content_type="text/markdown",
url="https://github.com/deepmodeling/deepmd-kit",
packages=['deepmd'],
python_requires=">=3.6",
classifiers=[
"Programming Language :: Python :: 3.6",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
],
keywords='deepmd',
install_requires=install_requires,
cmake_args=['-DTENSORFLOW_ROOT:STRING=%s' % tf_install_dir,
'-DBUILD_PY_IF:BOOL=TRUE',
'-DBUILD_CPP_IF:BOOL=FALSE',
'-DFLOAT_PREC:STRING=high',
'-DDP_PIP_INSTALL_PATH=%s' % dp_pip_install_path,
'-DDP_SETUP_INSTALL_PATH=%s' % dp_setup_install_path,
],
cmake_source_dir='source',
cmake_minimum_required_version='3.0',
extras_require={
'test': ['dpdata>=0.1.9'],
},
entry_points={
'console_scripts': ['dp = deepmd.main:main']
}
)