Skip to content

Commit

Permalink
remove vs detection in 110 notebook (#1815)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored Mar 12, 2024
1 parent 8eae3f0 commit 42d80f8
Showing 1 changed file with 0 additions and 77 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -79,67 +78,13 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Imports\n",
"[back to top ⬆️](#Table-of-contents:)\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# On Windows, try to find the directory that contains x64 cl.exe and add it to the PATH to enable PyTorch\n",
"# to find the required C++ tools. This code assumes that Visual Studio is installed in the default\n",
"# directory. If you have a different C++ compiler, please add the correct path to os.environ[\"PATH\"]\n",
"# directly. Note that the C++ Redistributable is not enough to run this notebook.\n",
"\n",
"# Adding the path to os.environ[\"LIB\"] is not always required - it depends on the system's configuration\n",
"\n",
"import sys\n",
"\n",
"if sys.platform == \"win32\":\n",
" import distutils.command.build_ext\n",
" import os\n",
" from pathlib import Path\n",
"\n",
" if sys.getwindowsversion().build >= 20000: # Windows 11\n",
" search_path = \"**/Hostx64/x64/cl.exe\"\n",
" else:\n",
" search_path = \"**/Hostx86/x64/cl.exe\"\n",
"\n",
" VS_INSTALL_DIR_2019 = r\"C:/Program Files (x86)/Microsoft Visual Studio\"\n",
" VS_INSTALL_DIR_2022 = r\"C:/Program Files/Microsoft Visual Studio\"\n",
"\n",
" cl_paths_2019 = sorted(list(Path(VS_INSTALL_DIR_2019).glob(search_path)))\n",
" cl_paths_2022 = sorted(list(Path(VS_INSTALL_DIR_2022).glob(search_path)))\n",
" cl_paths = cl_paths_2019 + cl_paths_2022\n",
"\n",
" if len(cl_paths) == 0:\n",
" raise ValueError(\n",
" \"Cannot find Visual Studio. This notebook requires an x64 C++ compiler. If you installed \"\n",
" \"a C++ compiler, please add the directory that contains cl.exe to `os.environ['PATH']`.\"\n",
" )\n",
" else:\n",
" # If multiple versions of MSVC are installed, get the most recent version\n",
" cl_path = cl_paths[-1]\n",
" vs_dir = str(cl_path.parent)\n",
" os.environ[\"PATH\"] += f\"{os.pathsep}{vs_dir}\"\n",
" # Code for finding the library dirs from\n",
" # https://stackoverflow.com/questions/47423246/get-pythons-lib-path\n",
" d = distutils.core.Distribution()\n",
" b = distutils.command.build_ext.build_ext(d)\n",
" b.finalize_options()\n",
" os.environ[\"LIB\"] = os.pathsep.join(b.library_dirs)\n",
" print(f\"Added {vs_dir} to PATH\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -200,7 +145,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -226,7 +170,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -278,7 +221,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -319,7 +261,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -328,7 +269,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -403,7 +343,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -452,7 +391,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": []
Expand Down Expand Up @@ -498,7 +436,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": []
Expand Down Expand Up @@ -531,10 +468,8 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
Expand Down Expand Up @@ -578,7 +513,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"execution": {
Expand Down Expand Up @@ -710,7 +644,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -753,10 +686,8 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
Expand All @@ -768,7 +699,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": []
Expand Down Expand Up @@ -855,7 +785,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": []
Expand Down Expand Up @@ -892,7 +821,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": []
Expand Down Expand Up @@ -948,7 +876,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": []
Expand Down Expand Up @@ -1046,7 +973,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": []
Expand All @@ -1063,7 +989,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1101,7 +1026,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": []
Expand Down Expand Up @@ -1150,7 +1074,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down

0 comments on commit 42d80f8

Please sign in to comment.