-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
170 lines (146 loc) · 4.32 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import os
from setuptools import find_packages, setup
import setuptools.command.install
import setuptools.command.develop
import subprocess
# Package meta-data.
NAME = 'nvsf'
DESCRIPTION = 'Novel View Synthesis Framework'
URL = 'https://github.com/gaurav00700/Selfsupervised-NVSF'
EMAIL = 'gauravsharma0509@gmail.com'
AUTHOR = 'Gaurav Sharma'
REQUIRES_PYTHON = '>=3.9.0'
VERSION = '0.1.0'
# What packages are required for this module to be executed?
REQUIRED = [
# "torch@https://download.pytorch.org/whl/cu118/torch-2.1.2%2Bcu118-cp39-cp39-linux_x86_64.whl",
# "torchvision@https://download.pytorch.org/whl/cu118/torchvision-0.16.2%2Bcu118-cp39-cp39-linux_x86_64.whl",
"torch-ema",
"torchmetrics",
"ninja",
"trimesh",
"opencv-python",
"tensorboardX",
"numpy==1.24",
"pandas",
"tqdm",
"matplotlib==3.5.2",
"PyMCubes",
"rich",
"pysdf",
"dearpygui",
"packaging",
"scipy",
"lpips",
"imageio==2.13.0",
"torchmetrics",
"imageio-ffmpeg==0.4.8",
"open3d",
"configargparse",
"scikit-image",
"nksr",
"black",
"pyquaternion",
"camtools==0.1.3",
"natsort",
"ujson",
"pyglet==1.5.29",
]
# Additional URLs for packages
DEPENDENCY_LINKS = [
# "https://download.pytorch.org/whl/cu118",
]
EXTRAS = {
# 'feature': ['django'],
}
here = os.path.abspath(os.path.dirname(__file__))
with open("readme.md") as f:
README = f.read()
# Load the package's __version__.py module as a dictionary.
about = {}
if not VERSION:
project_slug = NAME.lower().replace("-", "_").replace(" ", "_")
with open(os.path.join(here, project_slug, '__version__.py')) as f:
exec(f.read(), about)
else:
about['__version__'] = VERSION
# find packages
# PACKAGES = find_packages(where='.', include=["nvsf", "nvsf.*"])
PACKAGES = find_packages()
PACKAGES_DIRS={
'nerf': 'nvsf',
'scripts': 'nvsf',
'preprocess': 'nvsf',
}
def install_packages():
# Install pip dependencies with extra index url
subprocess.check_call([
'pip', 'install', 'torch==2.1.2+cu118', 'torchvision==0.16.2+cu118',
'--extra-index-url', 'https://download.pytorch.org/whl/cu118', #'--upgrade', '--force-reinstall', '--no-cache-dir'
])
# Install cuda tookit locally (use CUDA_HOME=CONDA_PREFIX)
subprocess.check_call([
'conda', 'install', '-c', 'nvidia/label/cuda-11.8.0', 'cuda-toolkit', '-y'
])
# Install git dependencies
subprocess.check_call([
'pip', 'install', 'ninja', 'git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch',
])
# Install other requirement packages
subprocess.check_call(['pip', 'install',] + REQUIRED)
# Install cuda extensions
subprocess.check_call([
'pip', 'install',
'nvsf/nerf/raymarching',
'nvsf/nerf/chamfer3D'
])
class CustomInstallCommand(setuptools.command.install.install):
"""Standard installation"""
def run(self):
# Run the standard install first
setuptools.command.install.install.run(self)
install_packages()
class CustomDevelopCommand(setuptools.command.develop.develop):
"""Development installation"""
def run(self):
# Run the standard develop command
setuptools.command.develop.develop.run(self)
install_packages()
# custom install
CUSTOM_INSTALL = {
'install': CustomInstallCommand,
'develop': CustomDevelopCommand,
}
# CLI scripts
ENTRY_POINTS = {
"console_scripts": [
"train_nvsf = nvsf.scripts.main_nvsf:main",
]
}
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
long_description=README,
long_description_content_type='text/markdown',
author=AUTHOR,
author_email=EMAIL,
python_requires=REQUIRES_PYTHON,
url=URL,
packages=PACKAGES,
# package_dir=PACKAGES_DIRS,
# install_requires=REQUIRED,
# dependency_links = DEPENDENCY_LINKS,
extras_require=EXTRAS,
cmdclass=CUSTOM_INSTALL,
entry_points=ENTRY_POINTS,
include_package_data=True,
license='None',
classifiers=[
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: PyPy'
],
)