Skip to content

Commit a83ed1d

Browse files
committed
Add support for NumPy 1.24.* (pt. 2)
1 parent feaeea2 commit a83ed1d

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

install.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,36 @@
1111
launch.run_pip("install packaging", "packaging requirement for depthmap script")
1212
from packaging.version import Version
1313

14+
def ensure(module_name, min_version=None):
15+
if launch.is_installed(module_name):
16+
if min_version is None or Version(importlib_metadata.version(module_name)) >= Version(min_version):
17+
return
18+
cmd = f'install "{module_name}>={min_version}"' if min_version is not None else f'install {module_name}'
19+
msg = f'{module_name} {min_version + " " if min_version is not None else ""}requirement for depthmap script'
20+
launch.run_pip(cmd, msg)
21+
1422
if not launch.is_installed("timm"): #0.6.7
1523
launch.run_pip('install --force-reinstall "timm==0.6.12"', "timm requirement for depthmap script")
1624

17-
if not launch.is_installed("matplotlib"):
18-
launch.run_pip("install matplotlib", "matplotlib requirement for depthmap script")
25+
ensure('matplotlib')
26+
27+
ensure('trimesh')
1928

20-
if not launch.is_installed("trimesh"):
21-
launch.run_pip("install trimesh", "requirements for depthmap script")
22-
23-
if not launch.is_installed("numba") or Version(importlib_metadata.version("numba")) < Version("0.57.0"):
24-
launch.run_pip('install "numba>=0.57.0"', "numba requirement for depthmap script")
25-
if not launch.is_installed("vispy"):
26-
launch.run_pip("install vispy", "vispy requirement for depthmap script")
29+
ensure('numba', '0.57.0')
30+
ensure('vispy')
2731

28-
if not launch.is_installed("rembg"):
29-
launch.run_pip("install rembg", "rembg requirement for depthmap script")
32+
ensure('rembg')
3033

3134
if not launch.is_installed("moviepy"):
3235
launch.run_pip('install "moviepy==1.0.2"', "moviepy requirement for depthmap script")
33-
if not launch.is_installed("transforms3d"):
34-
launch.run_pip("install transforms3d", "transforms3d requirement for depthmap script")
35-
if not launch.is_installed("imageio"): #2.4.1
36-
launch.run_pip("install imageio", "imageio requirement for depthmap script")
37-
if not launch.is_installed("imageio-ffmpeg"):
38-
launch.run_pip("install imageio-ffmpeg", "imageio-ffmpeg requirement for depthmap script")
36+
ensure('transforms3d', '0.4.1')
37+
38+
ensure('imageio') # 2.4.1
39+
ensure('imageio-ffmpeg')
3940
if not launch.is_installed("networkx"):
4041
launch.run_pip('install install "networkx==2.5"', "networkx requirement for depthmap script")
4142
if platform.system() == 'Windows':
42-
if not launch.is_installed("pyqt5"):
43-
launch.run_pip("install pyqt5", "pyqt5 requirement for depthmap script")
43+
ensure('pyqt5')
4444

4545
if platform.system() == 'Darwin':
46-
if not launch.is_installed("pyqt6"):
47-
launch.run_pip("install pyqt6", "pyqt6 requirement for depthmap script")
46+
ensure('pyqt6')

0 commit comments

Comments
 (0)