{"id":148248,"date":"2023-10-16T11:34:42","date_gmt":"2023-10-16T15:34:42","guid":{"rendered":"http:\/\/www.bu.edu\/tech\/?page_id=148248"},"modified":"2024-04-22T21:12:19","modified_gmt":"2024-04-23T01:12:19","slug":"code-server","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/tech\/support\/research\/software-and-programming\/common-languages\/python\/python-editing\/code-server\/","title":{"rendered":"VS Code Server"},"content":{"rendered":"<p><a name=\"top\"><\/a><\/p>\n<div style=\"width:100%;\">\n<div style=\"float:right;width:42%;\"><img loading=\"lazy\" src=\"\/tech\/files\/2023\/12\/coder-e1702918206954.png\" alt=\"\" width=\"600\" height=\"380\" class=\"alignnone size-full wp-image-149635\" \/><\/div>\n<div style=\"float:none;\">\n<h2>Code Server OnDemand Interactive App<\/h2>\n<p>This is our recommended way to use Python within VS Code on the SCC. To launch VS Code from SCC OnDemand, you will need to start a Code Server Interactive App, install the Python plugin, and load your preferred environment (i.e. Python or Conda).<\/p><\/div>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<div class=\"highlight-yellow\"><strong>Note<\/strong>: Code Server is an open-source application designed for OnDemand. It does not have access to the Microsoft Marketplace for VS Code extensions. Instead, extensions are installed from the Coder Marketplace.<\/span><\/div>\n<ol type=\"1\">\n<li>Open a browser and login to <a href=\"https:\/\/scc-ondemand.bu.edu\">https:\/\/scc-ondemand.bu.edu<\/a> with your BU credentials.<\/li>\n<li>Click <b>Interactive Apps<\/b> &gt; <b>VS Code Server<\/b>.<br \/>\n&nbsp;<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/08\/Screen-Shot-2023-08-07-at-4.46.42-PM-550x636.png\" alt=\"\" width=\"550\" height=\"636\" class=\"alignnone size-medium wp-image-147012\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/08\/Screen-Shot-2023-08-07-at-4.46.42-PM-550x636.png 550w, https:\/\/www.bu.edu\/tech\/files\/2023\/08\/Screen-Shot-2023-08-07-at-4.46.42-PM-885x1024.png 885w, https:\/\/www.bu.edu\/tech\/files\/2023\/08\/Screen-Shot-2023-08-07-at-4.46.42-PM-768x888.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/08\/Screen-Shot-2023-08-07-at-4.46.42-PM.png 944w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/li>\n<li>Specify in the the <b>Working Directory<\/b> field the directory for your files. The default is your home directory.<br \/>\n&nbsp;<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/work-1-636x110.png\" alt=\"\" width=\"636\" height=\"110\" class=\"alignnone size-medium wp-image-148349\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/work-1-636x110.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/work-1-768x133.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/work-1.png 772w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<li>Click one of the Python environment options below for further instructions within that package manager:<br \/>\n<!-- RADIO BUTTON TABLE --><\/p>\n<table border=\"0\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><input name=\"manager\" id=\"python1\" onclick=\"show_manager('python')\" value=\"python\" type=\"radio\" \/><br \/>\n<strong><label for=\"python1\">Python<\/label><\/strong><\/td>\n<td style=\"text-align: center;\"><input name=\"manager\" id=\"virtualenv1\" onclick=\"show_manager('virtualenv')\" value=\"virtualenv\" type=\"radio\" \/><br \/>\n<strong><label for=\"virtualenv1\">Python: virtualenv<\/label><\/strong><\/td>\n<td style=\"text-align: center;\"><input name=\"manager\" id=\"conda1\" onclick=\"show_manager('conda')\" value=\"conda\" type=\"radio\" \/><br \/>\n<strong><label for=\"conda1\">Miniconda: conda env<\/label><\/strong><\/td>\n<td style=\"text-align: center;\"><input name=\"manager\" id=\"select1\" onclick=\"show_manager('select')\" value=\"select\" type=\"radio\" \/><br \/>\n<strong><label for=\"select1\">hide<\/label><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><!-- PYTHON CONTENTS --><\/p>\n<div id=\"python\">\n&nbsp;<\/p>\n<ol type=\"A\">\n<li>On the VS Code Server request page, specify the version of Python you need in the <b>Additional modules to load<\/b> field. This will setup environment variables to associate the proper resources for your session and set the python interpreter. Click Launch to submit the request.<br \/>\n&nbsp;<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/vscode_py-636x343.png\" alt=\"\" width=\"636\" height=\"343\" class=\"alignnone size-medium wp-image-148356\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode_py-636x343.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode_py-768x414.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode_py.png 867w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p>&nbsp;<\/p>\n<li>Connect to your VS Code Server session and select the extensions icon on the left dashboard <code>[1]<\/code>. Search for the Python extension <strong>ms-python<\/strong> <code>[2]<\/code>, select it and install <code>[3]<\/code>.<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/vscode-pyext-636x499.png\" alt=\"\" width=\"636\" height=\"499\" class=\"alignnone size-medium wp-image-148364\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext-636x499.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext-1024x803.png 1024w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext-768x603.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext.png 1026w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p>&nbsp;<\/p>\n<li>Verify the correct Python interpreter is being loaded by opening your Python script and check the auto-detected interpreter in the bottom right corner.<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/confirm_py-636x23.png\" alt=\"\" width=\"636\" height=\"23\" class=\"alignnone size-medium wp-image-148361\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_py-636x23.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_py-1024x38.png 1024w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_py-768x28.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_py.png 1058w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p>&nbsp;<\/p>\n<li>If it was not auto-detected, click on the loaded Python interpreter in the bottom right corner to bring up the selection menu. Then choose the correct interpreter.<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/choose_py-636x269.png\" alt=\"\" width=\"636\" height=\"269\" class=\"alignnone size-medium wp-image-148362\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/choose_py-636x269.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/choose_py.png 688w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p><script type=\"text\/javascript\">\r\ndocument.getElementById('python').style.display = 'none';\r\n<\/script>\n<\/p><\/div>\n<p><!-- VIRTUALENV CONTENTS --><\/p>\n<div id=\"virtualenv\">\n&nbsp;<\/p>\n<ol type=\"A\">\n<li>On the VS Code Server request page, specify the version of Python you need in the <b>Additional modules to load<\/b> field AND add the command to source your environment under the <b>Pre-Launch Commands<\/b> field. This will setup environment variables to associate the proper resources for your session and set the python interpreter. Click Launch to submit the request.<br \/>\n&nbsp;<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/vscode_venv-636x346.png\" alt=\"\" width=\"636\" height=\"346\" class=\"alignnone size-medium wp-image-148357\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode_venv-636x346.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode_venv-768x418.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode_venv.png 881w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p>&nbsp;<\/p>\n<li>Connect to your VS Code Server session and select the extensions icon on the left dashboard <code>[1]<\/code>. Search for the Python extension <strong>ms-python<\/strong> <code>[2]<\/code>, select it and install <code>[3]<\/code>.<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/vscode-pyext-636x499.png\" alt=\"\" width=\"636\" height=\"499\" class=\"alignnone size-medium wp-image-148364\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext-636x499.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext-1024x803.png 1024w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext-768x603.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext.png 1026w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p>&nbsp;<\/p>\n<li>Verify the correct Python interpreter is being loaded by opening your Python script and check the auto-detected interpreter in the bottom right corner.<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/confirm_venv-636x19.png\" alt=\"\" width=\"636\" height=\"19\" class=\"alignnone size-medium wp-image-148373\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_venv-636x19.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_venv-1024x30.png 1024w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_venv-768x22.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_venv.png 1196w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p>&nbsp;<\/p>\n<li>If it was not auto-detected, click on the loaded Python interpreter in the bottom right corner to bring up the selection menu. Then choose the correct interpreter.<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/choose_venv-636x263.png\" alt=\"\" width=\"636\" height=\"263\" class=\"alignnone size-medium wp-image-148374\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/choose_venv-636x263.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/choose_venv.png 692w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p><script type=\"text\/javascript\">\r\ndocument.getElementById('virtualenv').style.display = 'none';\r\n<\/script>\n<\/p><\/div>\n<p><!-- CONDA CONTENTS --><\/p>\n<div id=\"conda\">\n&nbsp;<\/p>\n<ol type=\"A\">\n<li>On the VS Code Server request page, specify the version of Miniconda you need in the <b>Additional modules to load<\/b> field AND add the command to activate your environment under the <b>Pre-Launch Commands<\/b> field. This will setup environment variables to associate the proper resources for your session and set the python interpreter. Click Launch to submit the request.<br \/>\n&nbsp;<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/vscode_conda-636x350.png\" alt=\"\" width=\"636\" height=\"350\" class=\"alignnone size-medium wp-image-148358\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode_conda-636x350.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode_conda-768x422.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode_conda.png 871w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p>&nbsp;<\/p>\n<li>Connect to your VS Code Server session and select the extensions icon on the left dashboard <code>[1]<\/code>. Search for the Python extension <strong>ms-python<\/strong> <code>[2]<\/code>, select it and install <code>[3]<\/code>.<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/vscode-pyext-636x499.png\" alt=\"\" width=\"636\" height=\"499\" class=\"alignnone size-medium wp-image-148364\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext-636x499.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext-1024x803.png 1024w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext-768x603.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/vscode-pyext.png 1026w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p>&nbsp;<\/p>\n<li>Verify the correct Python interpreter is being loaded by opening your Python script and check the auto-detected interpreter in the bottom right corner.<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/confirm_conda-636x22.png\" alt=\"\" width=\"636\" height=\"22\" class=\"alignnone size-medium wp-image-148375\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_conda-636x22.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_conda-1024x36.png 1024w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_conda-768x27.png 768w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/confirm_conda.png 1067w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p>&nbsp;<\/p>\n<li>If it was not auto-detected, click on the loaded Python interpreter in the bottom right corner to bring up the selection menu. Then choose the correct interpreter.<br \/>\n<img loading=\"lazy\" src=\"\/tech\/files\/2023\/10\/choose_conda-636x371.png\" alt=\"\" width=\"636\" height=\"371\" class=\"alignnone size-medium wp-image-148376\" srcset=\"https:\/\/www.bu.edu\/tech\/files\/2023\/10\/choose_conda-636x371.png 636w, https:\/\/www.bu.edu\/tech\/files\/2023\/10\/choose_conda.png 639w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/li>\n<p><script type=\"text\/javascript\">\r\ndocument.getElementById('conda').style.display = 'none';\r\n<\/script>\n<\/p><\/div>\n<p><!-- BACKTOTOP --><\/p>\n<div id=\"backtotop\"><a href=\"#top\">Back to top<\/a><\/div>\n<\/li>\n<\/ol>\n<p><!-- JAVASCRIPT --><\/p>\n<p><script type=\"text\/javascript\">\r\nfunction show_manager(manager){    \r\nif (manager == \"python\"){\r\n \t   document.getElementById('python').style.display = 'block';\r\n \t   document.getElementById('virtualenv').style.display = 'none';\r\n \t   document.getElementById('conda').style.display = 'none';\r\n           document.getElementById('backtotop').style.display = 'block';\r\n  \t} \r\nelse if (manager == \"virtualenv\"){\r\n \t   document.getElementById('python').style.display = 'none';\r\n \t   document.getElementById('virtualenv').style.display = 'block';\r\n \t   document.getElementById('conda').style.display = 'none';\r\n           document.getElementById('backtotop').style.display = 'block';\r\n  \t} \r\nelse if (manager == \"conda\"){\r\n \t   document.getElementById('python').style.display = 'none';\r\n \t   document.getElementById('virtualenv').style.display = 'none';\r\n \t   document.getElementById('conda').style.display = 'block';\r\n           document.getElementById('backtotop').style.display = 'block';\r\n         }    \r\nelse {\r\n \t   document.getElementById('python').style.display = 'none';\r\n \t   document.getElementById('virtualenv').style.display = 'none';\r\n \t   document.getElementById('conda').style.display = 'none';\r\n           document.getElementById('backtotop').style.display = 'block';\r\n     }\r\n }\r\n<\/script><br \/>\n<!-- END CODE SERVER SECTION --><\/p>\n<div style=\"float: right;\">\n<p id=\"last-modified-timestamp\" style=\"margin: 0;\">Last updated: Loading&#8230;<\/p>\n<\/div>\n<p><script>\r\ndocument.addEventListener('DOMContentLoaded', function() {\r\n    \/\/ Get the content of the meta tag\r\n    var lastUpdatedContent = document.querySelector('meta[name=\"last-updated\"]').content;\r\n    \r\n    \/\/ Parse the content into a Date object\r\n    var lastUpdatedDate = new Date(lastUpdatedContent);\r\n    \r\n    \/\/ Format the date\r\n    var formattedDate = lastUpdatedDate.toLocaleDateString(undefined, { year: 'numeric', month: 'long', day: 'numeric' });\r\n    \r\n    \/\/ Update the HTML element with the formatted date\r\n    document.getElementById('last-modified-timestamp').innerHTML = 'Last updated: ' + formattedDate;\r\n});\r\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Code Server OnDemand Interactive App This is our recommended way to use Python within VS Code on the SCC. To launch VS Code from SCC OnDemand, you will need to start a Code Server Interactive App, install the Python plugin, and load your preferred environment (i.e. Python or Conda). &nbsp; &nbsp; &nbsp; Note: Code Server&#8230;<\/p>\n","protected":false},"author":1692,"featured_media":0,"parent":147624,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/148248"}],"collection":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/users\/1692"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/comments?post=148248"}],"version-history":[{"count":40,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/148248\/revisions"}],"predecessor-version":[{"id":151810,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/148248\/revisions\/151810"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/147624"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/media?parent=148248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}