forked from automl/auto-sklearn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
141 lines (120 loc) · 4.73 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# -*- encoding: utf-8 -*-
import os
import shutil
import subprocess
import sys
import tarfile
import urllib
import setuptools
from setuptools.extension import Extension
from setuptools.command.install import install
SMAC_DOWNLOAD_LOCATION = 'http://aad.informatik.uni-freiburg.de/~feurerm/'
SMAC_TAR_NAME = 'smac-v2.08.01-development-1.tar.gz'
# METADATA_LOCATION = "http://aad.informatik.uni-freiburg.de/~feurerm/"
# METADATA_TAR_NAME = "metadata_automl1_000.tar.gz"
RUNSOLVER_LOCATION = 'http://www.cril.univ-artois.fr/~roussel/runsolver/'
RUNSOLVER_TAR_NAME = 'runsolver-3.3.4.tar.bz2'
DOWNLOAD_DIRECTORY = os.path.join(os.path.dirname(__file__), '.downloads')
BINARIES_DIRECTORY = 'autosklearn/binaries'
METADATA_DIRECTORY = 'autosklearn/metalearning/files'
extensions = [Extension('autosklearn.data.competition_c_functions',
sources=[
'autosklearn/data/competition_c_functions.pyx'
])
]
class Download(install):
def run(self):
try:
shutil.rmtree(DOWNLOAD_DIRECTORY)
except Exception:
pass
try:
os.makedirs(DOWNLOAD_DIRECTORY)
except Exception:
pass
for download_url, filename in [
(SMAC_DOWNLOAD_LOCATION, SMAC_TAR_NAME),
# (METADATA_LOCATION, METADATA_TAR_NAME),
(RUNSOLVER_LOCATION, RUNSOLVER_TAR_NAME)
]:
# This can fail ungracefully, because having these files is
# crucial to AutoSklearn!
urllib.urlretrieve(
os.path.join(download_url, filename),
filename=os.path.join(DOWNLOAD_DIRECTORY, filename))
tfile = tarfile.open(os.path.join(DOWNLOAD_DIRECTORY, filename))
tfile.extractall(os.path.join(
DOWNLOAD_DIRECTORY,
filename.replace('.tar.gz', '').replace('.tar.bz2', '')))
# Build the runsolver
sys.stdout.write('Building runsolver\n')
cur_pwd = os.getcwd()
runsolver_source_path = os.path.join(DOWNLOAD_DIRECTORY,
'runsolver-3.3.4', 'runsolver',
'src')
os.chdir(runsolver_source_path)
subprocess.check_call('make')
os.chdir(cur_pwd)
# Create a fresh binaries directory
try:
shutil.rmtree(BINARIES_DIRECTORY)
except Exception:
pass
try:
os.makedirs(BINARIES_DIRECTORY)
with open(os.path.join(BINARIES_DIRECTORY, '__init__.py')):
pass
except Exception:
pass
# Copy the runsolver into the sources so it gets copied
shutil.move(os.path.join(runsolver_source_path, 'runsolver'),
os.path.join(BINARIES_DIRECTORY, 'runsolver'))
# Copy SMAC
shutil.move(os.path.join(DOWNLOAD_DIRECTORY,
SMAC_TAR_NAME.replace('.tar.gz', '')),
BINARIES_DIRECTORY)
# try:
# shutil.rmtree(METADATA_DIRECTORY)
# except Exception:
# pass
# Copy the metadata
# shutil.move(os.path.join(DOWNLOAD_DIRECTORY,
# METADATA_TAR_NAME.replace(".tar.gz", ""),
# "files"),
# METADATA_DIRECTORY)
# TODO: Normally one wants to call run(self), but this runs distutils and ignores install_requirements for unknown reasons
# if anyone knows a better way, feel free to change
install.do_egg_install(self)
# shutil.rmtree(os.path.join(METADATA_DIRECTORY))
shutil.rmtree(BINARIES_DIRECTORY)
shutil.rmtree(DOWNLOAD_DIRECTORY)
setuptools.setup(
name='AutoSklearn',
description='Code to participate in the AutoML 2015 challenge.',
version='0.0.1dev',
ext_modules=extensions,
packages=setuptools.find_packages(exclude=['test']),
install_requires=['setuptools',
'numpy>=0.16.0',
'psutil',
'pyyaml',
'scipy>=0.14.0',
'scikit-learn==0.16.1',
'nose',
'lockfile',
'HPOlibConfigSpace',
'ParamSklearn',
'six',
'ConfigArgParse',
'liac-arff',
'pandas'],
test_suite='nose.collector',
cmdclass={'install': Download},
scripts=['scripts/autosklearn'],
include_package_data=True,
author='Matthias Feurer',
author_email='feurerm@informatik.uni-freiburg.de',
license='BSD',
platforms=['Linux'],
classifiers=[],
url='www.automl.org')