Skip to content

Commit a852a4b

Browse files
Add wrapper for pip install to catch error (#2721)
CVS-159125
1 parent 311230c commit a852a4b

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

notebooks/stable-fast-3d/stable-fast-3d.ipynb

+27-10
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,24 @@
7979
" )\n",
8080
" open(\"cmd_helper.py\", \"w\").write(r.text)\n",
8181
"\n",
82+
"if not Path(\"pip_helper.py\").exists():\n",
83+
" r = requests.get(\n",
84+
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/pip_helper.py\",\n",
85+
" )\n",
86+
" open(\"pip_helper.py\", \"w\").write(r.text)\n",
87+
"\n",
8288
"\n",
83-
"%pip install -q \"gradio>=4.19\" \"openvino>=2024.3.0\" wheel \"gradio-litmodel3d==0.0.1\"\n",
84-
"%pip install -q \"torch>=2.2.2\" torchvision \"transformers>=4.42.3\" \"open_clip_torch==2.24.0\" --extra-index-url https://download.pytorch.org/whl/cpu\n",
85-
"%pip install -q \"omegaconf==2.4.0.dev3\"\n",
86-
"%pip install -q \"git+https://github.com/vork/PyNanoInstantMeshes.git\"\n",
87-
"%pip install -q jaxtyping gpytoolbox trimesh einops\n",
89+
"from pip_helper import pip_install\n",
90+
"\n",
91+
"\n",
92+
"pip_install(\"-q\", \"gradio>=4.19\", \"openvino>=2024.3.0\", \"wheel\", \"gradio-litmodel3d==0.0.1\")\n",
93+
"pip_install(\"-q\", \"torch>=2.2.2\", \"torchvision\", \"transformers>=4.42.3\", \"open_clip_torch==2.24.0\", \"--extra-index-url\", \"https://download.pytorch.org/whl/cpu\")\n",
94+
"pip_install(\"-q\", \"omegaconf==2.4.0.dev3\")\n",
95+
"pip_install(\"-q\", \"git+https://github.com/vork/PyNanoInstantMeshes.git\")\n",
96+
"pip_install(\"-q\", \"jaxtyping\", \"gpytoolbox\", \"trimesh\", \"einops\")\n",
8897
"# rembg requires opencv-python-headless that can't be installed with opencv-python. So, we install rembg without dependencies and install its requirements\n",
89-
"%pip install -q rembg --no-deps\n",
90-
"%pip install -q onnxruntime \"opencv-python\" pymatting pooch pynim\n",
98+
"pip_install(\"-q\", \"rembg\", \"--no-deps\")\n",
99+
"pip_install(\"-q\", \"onnxruntime\", \"opencv-python\", \"pymatting\", \"pooch\", \"pynim\")\n",
91100
"\n",
92101
"# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n",
93102
"from notebook_utils import collect_telemetry\n",
@@ -107,10 +116,10 @@
107116
"from cmd_helper import clone_repo\n",
108117
"\n",
109118
"\n",
110-
"clone_repo(\"https://github.com/Stability-AI/stable-fast-3d\", \"2b35658e6fa41df4171f15d8696102c62845f16a\")\n",
119+
"clone_repo(\"https://github.com/Stability-AI/stable-fast-3d\", \"ff21fc491b4dc5314bf6734c7c0dabd86b5f5bb2\")\n",
111120
"\n",
112-
"%pip install -q {Path(\"stable-fast-3d/texture_baker/\")}\n",
113-
"%pip install -q {Path(\"stable-fast-3d/uv_unwrapper/\")}"
121+
"pip_install(\"-q\", Path(\"stable-fast-3d/texture_baker/\"))\n",
122+
"pip_install(\"-q\", Path(\"stable-fast-3d/uv_unwrapper/\"))"
114123
]
115124
},
116125
{
@@ -122,6 +131,14 @@
122131
"## Get the original model"
123132
]
124133
},
134+
{
135+
"cell_type": "code",
136+
"execution_count": null,
137+
"id": "5b488801",
138+
"metadata": {},
139+
"outputs": [],
140+
"source": []
141+
},
125142
{
126143
"cell_type": "code",
127144
"execution_count": null,

0 commit comments

Comments
 (0)