|
1 | 1 | {
|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 |
| - "attachments": {}, |
5 | 4 | "cell_type": "markdown",
|
6 | 5 | "metadata": {},
|
7 | 6 | "source": [
|
|
79 | 78 | ]
|
80 | 79 | },
|
81 | 80 | {
|
82 |
| - "attachments": {}, |
83 | 81 | "cell_type": "markdown",
|
84 | 82 | "metadata": {},
|
85 | 83 | "source": [
|
86 | 84 | "## Imports\n",
|
87 | 85 | "[back to top ⬆️](#Table-of-contents:)\n"
|
88 | 86 | ]
|
89 | 87 | },
|
90 |
| - { |
91 |
| - "cell_type": "code", |
92 |
| - "execution_count": 2, |
93 |
| - "metadata": { |
94 |
| - "tags": [] |
95 |
| - }, |
96 |
| - "outputs": [], |
97 |
| - "source": [ |
98 |
| - "# On Windows, try to find the directory that contains x64 cl.exe and add it to the PATH to enable PyTorch\n", |
99 |
| - "# to find the required C++ tools. This code assumes that Visual Studio is installed in the default\n", |
100 |
| - "# directory. If you have a different C++ compiler, please add the correct path to os.environ[\"PATH\"]\n", |
101 |
| - "# directly. Note that the C++ Redistributable is not enough to run this notebook.\n", |
102 |
| - "\n", |
103 |
| - "# Adding the path to os.environ[\"LIB\"] is not always required - it depends on the system's configuration\n", |
104 |
| - "\n", |
105 |
| - "import sys\n", |
106 |
| - "\n", |
107 |
| - "if sys.platform == \"win32\":\n", |
108 |
| - " import distutils.command.build_ext\n", |
109 |
| - " import os\n", |
110 |
| - " from pathlib import Path\n", |
111 |
| - "\n", |
112 |
| - " if sys.getwindowsversion().build >= 20000: # Windows 11\n", |
113 |
| - " search_path = \"**/Hostx64/x64/cl.exe\"\n", |
114 |
| - " else:\n", |
115 |
| - " search_path = \"**/Hostx86/x64/cl.exe\"\n", |
116 |
| - "\n", |
117 |
| - " VS_INSTALL_DIR_2019 = r\"C:/Program Files (x86)/Microsoft Visual Studio\"\n", |
118 |
| - " VS_INSTALL_DIR_2022 = r\"C:/Program Files/Microsoft Visual Studio\"\n", |
119 |
| - "\n", |
120 |
| - " cl_paths_2019 = sorted(list(Path(VS_INSTALL_DIR_2019).glob(search_path)))\n", |
121 |
| - " cl_paths_2022 = sorted(list(Path(VS_INSTALL_DIR_2022).glob(search_path)))\n", |
122 |
| - " cl_paths = cl_paths_2019 + cl_paths_2022\n", |
123 |
| - "\n", |
124 |
| - " if len(cl_paths) == 0:\n", |
125 |
| - " raise ValueError(\n", |
126 |
| - " \"Cannot find Visual Studio. This notebook requires an x64 C++ compiler. If you installed \"\n", |
127 |
| - " \"a C++ compiler, please add the directory that contains cl.exe to `os.environ['PATH']`.\"\n", |
128 |
| - " )\n", |
129 |
| - " else:\n", |
130 |
| - " # If multiple versions of MSVC are installed, get the most recent version\n", |
131 |
| - " cl_path = cl_paths[-1]\n", |
132 |
| - " vs_dir = str(cl_path.parent)\n", |
133 |
| - " os.environ[\"PATH\"] += f\"{os.pathsep}{vs_dir}\"\n", |
134 |
| - " # Code for finding the library dirs from\n", |
135 |
| - " # https://stackoverflow.com/questions/47423246/get-pythons-lib-path\n", |
136 |
| - " d = distutils.core.Distribution()\n", |
137 |
| - " b = distutils.command.build_ext.build_ext(d)\n", |
138 |
| - " b.finalize_options()\n", |
139 |
| - " os.environ[\"LIB\"] = os.pathsep.join(b.library_dirs)\n", |
140 |
| - " print(f\"Added {vs_dir} to PATH\")" |
141 |
| - ] |
142 |
| - }, |
143 | 88 | {
|
144 | 89 | "cell_type": "code",
|
145 | 90 | "execution_count": 3,
|
|
200 | 145 | ]
|
201 | 146 | },
|
202 | 147 | {
|
203 |
| - "attachments": {}, |
204 | 148 | "cell_type": "markdown",
|
205 | 149 | "metadata": {},
|
206 | 150 | "source": [
|
|
226 | 170 | ]
|
227 | 171 | },
|
228 | 172 | {
|
229 |
| - "attachments": {}, |
230 | 173 | "cell_type": "markdown",
|
231 | 174 | "metadata": {},
|
232 | 175 | "source": [
|
|
278 | 221 | ]
|
279 | 222 | },
|
280 | 223 | {
|
281 |
| - "attachments": {}, |
282 | 224 | "cell_type": "markdown",
|
283 | 225 | "metadata": {},
|
284 | 226 | "source": [
|
|
319 | 261 | ]
|
320 | 262 | },
|
321 | 263 | {
|
322 |
| - "attachments": {}, |
323 | 264 | "cell_type": "markdown",
|
324 | 265 | "metadata": {},
|
325 | 266 | "source": [
|
|
328 | 269 | ]
|
329 | 270 | },
|
330 | 271 | {
|
331 |
| - "attachments": {}, |
332 | 272 | "cell_type": "markdown",
|
333 | 273 | "metadata": {},
|
334 | 274 | "source": [
|
|
403 | 343 | ]
|
404 | 344 | },
|
405 | 345 | {
|
406 |
| - "attachments": {}, |
407 | 346 | "cell_type": "markdown",
|
408 | 347 | "metadata": {},
|
409 | 348 | "source": [
|
|
452 | 391 | ]
|
453 | 392 | },
|
454 | 393 | {
|
455 |
| - "attachments": {}, |
456 | 394 | "cell_type": "markdown",
|
457 | 395 | "metadata": {
|
458 | 396 | "tags": []
|
|
498 | 436 | ]
|
499 | 437 | },
|
500 | 438 | {
|
501 |
| - "attachments": {}, |
502 | 439 | "cell_type": "markdown",
|
503 | 440 | "metadata": {
|
504 | 441 | "tags": []
|
|
531 | 468 | ]
|
532 | 469 | },
|
533 | 470 | {
|
534 |
| - "attachments": {}, |
535 | 471 | "cell_type": "markdown",
|
536 | 472 | "metadata": {
|
537 |
| - "collapsed": false, |
538 | 473 | "jupyter": {
|
539 | 474 | "outputs_hidden": false
|
540 | 475 | }
|
|
578 | 513 | ]
|
579 | 514 | },
|
580 | 515 | {
|
581 |
| - "attachments": {}, |
582 | 516 | "cell_type": "markdown",
|
583 | 517 | "metadata": {
|
584 | 518 | "execution": {
|
|
710 | 644 | ]
|
711 | 645 | },
|
712 | 646 | {
|
713 |
| - "attachments": {}, |
714 | 647 | "cell_type": "markdown",
|
715 | 648 | "metadata": {},
|
716 | 649 | "source": [
|
|
753 | 686 | ]
|
754 | 687 | },
|
755 | 688 | {
|
756 |
| - "attachments": {}, |
757 | 689 | "cell_type": "markdown",
|
758 | 690 | "metadata": {
|
759 |
| - "collapsed": false, |
760 | 691 | "jupyter": {
|
761 | 692 | "outputs_hidden": false
|
762 | 693 | }
|
|
768 | 699 | ]
|
769 | 700 | },
|
770 | 701 | {
|
771 |
| - "attachments": {}, |
772 | 702 | "cell_type": "markdown",
|
773 | 703 | "metadata": {
|
774 | 704 | "tags": []
|
|
855 | 785 | ]
|
856 | 786 | },
|
857 | 787 | {
|
858 |
| - "attachments": {}, |
859 | 788 | "cell_type": "markdown",
|
860 | 789 | "metadata": {
|
861 | 790 | "tags": []
|
|
892 | 821 | ]
|
893 | 822 | },
|
894 | 823 | {
|
895 |
| - "attachments": {}, |
896 | 824 | "cell_type": "markdown",
|
897 | 825 | "metadata": {
|
898 | 826 | "tags": []
|
|
948 | 876 | ]
|
949 | 877 | },
|
950 | 878 | {
|
951 |
| - "attachments": {}, |
952 | 879 | "cell_type": "markdown",
|
953 | 880 | "metadata": {
|
954 | 881 | "tags": []
|
|
1046 | 973 | ]
|
1047 | 974 | },
|
1048 | 975 | {
|
1049 |
| - "attachments": {}, |
1050 | 976 | "cell_type": "markdown",
|
1051 | 977 | "metadata": {
|
1052 | 978 | "tags": []
|
|
1063 | 989 | ]
|
1064 | 990 | },
|
1065 | 991 | {
|
1066 |
| - "attachments": {}, |
1067 | 992 | "cell_type": "markdown",
|
1068 | 993 | "metadata": {},
|
1069 | 994 | "source": [
|
|
1101 | 1026 | ]
|
1102 | 1027 | },
|
1103 | 1028 | {
|
1104 |
| - "attachments": {}, |
1105 | 1029 | "cell_type": "markdown",
|
1106 | 1030 | "metadata": {
|
1107 | 1031 | "tags": []
|
|
1150 | 1074 | ]
|
1151 | 1075 | },
|
1152 | 1076 | {
|
1153 |
| - "attachments": {}, |
1154 | 1077 | "cell_type": "markdown",
|
1155 | 1078 | "metadata": {},
|
1156 | 1079 | "source": [
|
|
0 commit comments