-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
106 lines (90 loc) · 3.2 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from setuptools import setup, find_packages
import ctypes
# to check pip version
import pkg_resources
pipVersion = pkg_resources.require("pip")[0].version
setuptoolsVersion = pkg_resources.require("setuptools")[0].version
print("\n PIP Version", pipVersion, "\n")
print("\n Setuptools Version", setuptoolsVersion, "\n")
olderPip = pipVersion < "20.0"
olderSetuptools = setuptoolsVersion < "45.0"
def checkCUDAisAvailable():
"""
This function check if any of this possible libs are available.
see https://gist.github.com/f0k/63a664160d016a491b2cbea15913d549
Returns:
--------
libsOk : bool
If True then CUDA is available
"""
# some possible lib names
libnames = ('libcuda.so', 'libcuda.dylib', 'cuda.dll')
libsOk = True
for libname in libnames:
try:
cuda = ctypes.CDLL(libname)
except OSError:
continue
else:
break
else:
libsOk = False
return libsOk
def getRequirements():
"""
This function it's used in order to get the package names. Which
depends on the libs available in the machine.
Return:
-------
conditionalRequirements: list
A list of strings containing the pip pkgs.
"""
cudaLibsOk = checkCUDAisAvailable()
conditionalRequirements = []
if cudaLibsOk:
conditionalRequirements += ["tensorflow-gpu==1.15.3", ]
else:
print("\n CUDA it's not available in your machine.")
print(" You won't be able to use the GPU support.\n")
#if olderPip or olderSetuptools:
#tfRequirement = "tensorflow==1.15.0"
#else:
tfRequirement = "tensorflow==1.15.3"
conditionalRequirements += [tfRequirement]
return conditionalRequirements
conditionalRequirements = getRequirements()
install_requires = ["scipy", "numpy"] + conditionalRequirements
with open("README.md", "r") as f:
README_TEXT = f.read()
setup(
name="emate",
version="v1.1.3",
packages=find_packages(exclude=["build", ]),
long_description=README_TEXT,
long_description_content_type="text/markdown",
install_requires=install_requires,
include_package_data=True,
license="MIT",
description="""eMaTe can run in both CPU and GPU and can
estimate the spectral density and related trace functions,
such as entropy and Estrada index, even in matrices
(directed or undirected graphs) with
million of nodes.""",
author_email="[email protected]",
author="Bruno Messias; Thomas K Peron",
download_url="https://github.com/stdogpkg/emate/archive/v1.0.4.tar.gz",
keywords=[
"gpu", "science", "complex-networks", "graphs", "matrices", "kpm",
"tensorflow", "chebyshev", "spectral", "eigenvalues"
],
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Information Analysis"
],
url="https://github.com/stdogpkg/emate"
)