From e598afed8244bf5ca08da92696eb5ef5347959b4 Mon Sep 17 00:00:00 2001 From: UuuNyaa Date: Fri, 30 Dec 2022 06:58:47 -0800 Subject: [PATCH] Ensure pip #1 --- motion_generate_tools/__init__.py | 2 +- motion_generate_tools/setup_utils.py | 45 +++++++++++++++------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/motion_generate_tools/__init__.py b/motion_generate_tools/__init__.py index e1651f7..6245cac 100644 --- a/motion_generate_tools/__init__.py +++ b/motion_generate_tools/__init__.py @@ -18,7 +18,7 @@ bl_info = { "name": "motion_generate_tools", "author": "UuuNyaa", - "version": (0, 0, 1), + "version": (0, 0, 3), "blender": (3, 3, 0), "location": "View3D > Sidebar > Panel", "description": "Utility tools for motion generating.", diff --git a/motion_generate_tools/setup_utils.py b/motion_generate_tools/setup_utils.py index 2acf32b..8644ad9 100644 --- a/motion_generate_tools/setup_utils.py +++ b/motion_generate_tools/setup_utils.py @@ -80,31 +80,36 @@ def delete_clip_model(): def install_python_modules(use_gpu=False, line_callback: Optional[LineCallback] = None, finally_callback: Optional[FinallyCallback] = None): _get_command_executor().exec_command( - # force install setuptools - sys.executable, '-m', 'pip', 'install', - '--disable-pip-version-check', - '--no-input', - '--ignore-installed', - 'setuptools', + # ensurepip + sys.executable, '-m', 'ensurepip', line_callback=line_callback, finally_callback=lambda e: e.exec_command( - # and then install depending modules + # force install setuptools sys.executable, '-m', 'pip', 'install', '--disable-pip-version-check', '--no-input', - '--upgrade', - # '--upgrade-strategy', 'only-if-needed', - # '--no-cache-dir', - '--exists-action', 'i', - # '--ignore-installed', - '--extra-index-url', 'https://download.pytorch.org/whl/cu116' if use_gpu else 'https://download.pytorch.org/whl/cpu', - 'torch', - 'numpy<1.24.0', - 'git+https://github.com/openai/CLIP.git', - 'smplx', - 'scipy', - 'chumpy', - line_callback=line_callback, finally_callback=finally_callback + '--ignore-installed', + 'setuptools', + line_callback=line_callback, + finally_callback=lambda e: e.exec_command( + # and then install depending modules + sys.executable, '-m', 'pip', 'install', + '--disable-pip-version-check', + '--no-input', + '--upgrade', + # '--upgrade-strategy', 'only-if-needed', + # '--no-cache-dir', + '--exists-action', 'i', + # '--ignore-installed', + '--extra-index-url', 'https://download.pytorch.org/whl/cu116' if use_gpu else 'https://download.pytorch.org/whl/cpu', + 'torch', + 'numpy<1.24.0', + 'git+https://github.com/openai/CLIP.git', + 'smplx', + 'scipy', + 'chumpy', + line_callback=line_callback, finally_callback=finally_callback + ) ) )