-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
50 lines (38 loc) · 1.64 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
import os
import sys
import setuptools
import subprocess
# @TODO: Figure out a way to check for this
is_installed_from_pypi = False
def remove_requirements(requirements, name, replace=''):
new_requirements = []
for requirement in requirements:
if requirement.split(' ')[0] != name:
new_requirements.append(requirement)
elif replace is not None:
new_requirements.append(replace)
return new_requirements
sys_platform = sys.platform
with open('requirements.txt') as req_file:
requirements = [req.strip() for req in req_file.read().splitlines()]
# Windows specific requirements
if sys_platform in ['win32','cygwin','windows']:
requirements = remove_requirements(requirements,'torch')
requirements = remove_requirements(requirements,'torchvision')
try:
subprocess.call(['pip','install','torch===1.2.0', '-f', 'https://download.pytorch.org/whl/torch_stable.html'])
subprocess.call(['pip','install','torchvision===0.4'])
print('Successfully installed pytorch and torchvision!')
except:
print('Failed to install pytroch, please install pytroch and torchvision manually be following the simple instructions over at: https://pytorch.org/get-started/locally/')
setuptools.setup(name='testypy',
version='1.1.1',
description='The testpypy awesome module',
url='https://github.com/ZoranPandovski/testypy',
author='Zoran Pan',
author_email='zoran.pandovski@gmail.com',
license='MIT',
packages=setuptools.find_packages(),
package_data={'project': ['requirements.txt']},
install_requires=requirements,
zip_safe=False)