{"id":8562,"date":"2023-07-13T09:00:00","date_gmt":"2023-07-13T13:00:00","guid":{"rendered":"https:\/\/blogs.swarthmore.edu\/its\/?p=8562"},"modified":"2023-07-12T13:46:39","modified_gmt":"2023-07-12T17:46:39","slug":"managing-research-software-environments","status":"publish","type":"post","link":"https:\/\/blogs.swarthmore.edu\/its\/2023\/07\/13\/managing-research-software-environments\/","title":{"rendered":"Managing Research Software Environments"},"content":{"rendered":"\n<p>The landscape of research software is certainly rich and varied, driven in part by improved sharing and dissemination platforms (such as GitHub), as well as by enhanced mandates to provide access to software and workflows arising from nearly any federal grant (NSF, NIH, etc.). On the one hand, this affords researchers a robust toolkit to bring to bear on their scientific workflows. On the other hand, however, each tool may have been developed in an environment exceptionally dissimilar to one you have access to. As a result, programs or entire workflows might rely on a particular operating system (RHEL, Debian, etc.), a specific version of a compiler, mandatory libraries, or other dependencies that are incredibly challenging &#8211; or outright impossible &#8211; to install locally. This issue works both ways: how can you, as a researcher, ensure that software you develop is available and usable by the greatest number of people?<\/p>\n\n\n\n<p>Thankfully, various tools have developed to address this issue, though to be clear much work remains to make some of them user-friendly. While this post is not meant to cover all tools and their attendant use cases, it will introduce a handful of them, including Anaconda and Spack.<\/p>\n\n\n\n<p>Anaconda (usually just called Conda) is one of the most robust and widely-used tools to create and share Python-based research environments. The basic steps &#8211; as outlined in our <a href=\"https:\/\/kb.swarthmore.edu\/display\/ACADTECH\/Python+on+Strelka#PythononStrelka-Miniconda\" target=\"_blank\" rel=\"noreferrer noopener\">help documentation<\/a> &#8211; involve creating a distinct named environment that will contain the specific version of Python and other packages that drive your research workflow, insulating them from system-level versions that may change, go away, etc. These environments can be loaded and changed as needed, and can be exported easily to ensure that anyone working on the same project is using an identical environment, a critical cornerstone of reproducible science.<\/p>\n\n\n\n<p>Anaconda works great for projects that are entirely, or largely, Python-based, but what happens when you need a broader suite of tools, or perhaps have software that requires a newer\/older version of low-level system tools, such as gcc? Spack provides a way to manage such an environment (note: Spack is <em>exceptionally<\/em> complex, so this brief post can&#8217;t remotely convey anything beyond an extremely simple use case). While a more complete help document will be forthcoming, <a href=\"https:\/\/spack-tutorial.readthedocs.io\/en\/latest\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">an excellent Spack tutorial is available<\/a>. In general, however, it functions similar to Conda, where you can create an environment and install various specific versions of software that become available when the environment is activated. And, like Conda, these environments can be exported and shared. Here is a brief example to install a local copy of the most recent gcc on a Linux system:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">git clone --depth=100 --branch=releases\/v0.20 https:\/\/github.com\/spack\/spack.git ~\/spack\r\ncd spack\r\n. share\/spack\/setup-env.sh\r\nspack env create testenv\r\nspack env activate testenv\r\nspack add gcc\r\nspack install<\/code><\/pre>\n\n\n\n<p>At this point, you can check whether it worked by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">which gcc<\/code><\/pre>\n\n\n\n<p>It should output a path similar to this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">~\/spack\/var\/spack\/environments\/testenv\/.spack-env\/view\/bin\/gcc<\/code><\/pre>\n\n\n\n<p>Assuming it does, you need to add the libraries to your system environment:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">export LD_LIBRARY_PATH=~\/spack\/var\/spack\/environments\/testenv\/.spack-env\/view\/lib64<\/code><\/pre>\n\n\n\n<p>When finished working in your Spack environment, deactivate it with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">spack env deactivate<\/code><\/pre>\n\n\n\n<p>The need to manage complex software environments is only growing. Tools exist, however, to assist with doing so. Not only can this be helpful for dedicated research systems, such as Strelka, but also you can use many of them on your local system, and if needed you can export environments and recreate them elsewhere, seamlessly. This is a best practice for reproducible science and is a great habit to develop!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The landscape of research software is certainly rich and varied, driven in part by improved sharing and dissemination platforms (such as GitHub), as well as by enhanced mandates to provide access to software and workflows arising from nearly any federal &hellip; <a href=\"https:\/\/blogs.swarthmore.edu\/its\/2023\/07\/13\/managing-research-software-environments\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Managing Research Software Environments<\/span><\/a><\/p>\n","protected":false},"author":77,"featured_media":8565,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,450,303,357,430,97],"tags":[347,90,201,481,358],"class_list":{"0":"post-8562","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-academic-technology","8":"category-data-science","9":"category-development","10":"category-high-performance-computing","11":"category-research","12":"category-software","13":"tag-data-analysis","14":"tag-featured","15":"tag-research","16":"tag-research-computing","17":"tag-strelka","19":"fallback-thumbnail"},"jetpack_featured_media_url":"https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2023\/07\/code-g6f6b9d9a5_640.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/ph2nPL-2e6","_links":{"self":[{"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/posts\/8562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/comments?post=8562"}],"version-history":[{"count":3,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/posts\/8562\/revisions"}],"predecessor-version":[{"id":8566,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/posts\/8562\/revisions\/8566"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/media\/8565"}],"wp:attachment":[{"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/media?parent=8562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/categories?post=8562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/tags?post=8562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}