The sleight-of-hand trick that can simplify scientific computing – Nature.com
Research software is like the tower-building game Jenga tools atop tools atop tools. When developers tweak their individual pieces, this can change the function of the software that depends on them, potentially altering results or causing the software to fail.
Version 3.6.0 of the R programming language, for instance, introduced a replacement algorithm for generating random numbers. This and the older algorithm both work, but not in the same way. If you ran the same code with an older version of R and a newer version of R and it was using any function that needed to generate a random number, you would end up getting different results, says Tiffany Timbers, a data scientist at the University of British Columbia in Vancouver, Canada.
Among other things, that kind of variability can complicate collaboration (see Environmental testing). In 2020, Mine etinkaya-Rundel was working with another author on a statistics textbook, using R and a formatting language called R Markdown to calculate numbers, create figures and format the final document. We wanted to make sure that we were using the same versions, says etinkaya-Rundel, a statistician at Duke University in Durham, North Carolina, and also that when we re-render the book, were rendering it with a given version of the packages. If not, the two authors could have generated slightly different manuscripts.
An example of how variable computing environments can hinder collaboration.
Suppose you have the latest versions of R and Python installed, but your collaborator has been slower to upgrade. They want to share a Python script with you, and you have an R program you want them to use. Will the code work in each others hands?
Between Python 2 and Python 3, the print command that outputs text to the screen changed. The directive print hello, world! is valid in Python 2, but Python 3 requires parentheses print (hello, world!). Similarly, before R 4.0, the function that creates spreadsheet-like data tables treated text as discrete factors by default, whereas later versions do not.
To highlight these differences, we created scripts and environments for Python 2.7, Python 3.11, R 3.6 and R 4.2 (see go.nature.com/4tirjm7). Following the instructions (see go.nature.com/4tnd5ke), install conda. Then, open a terminal window, run the set-up script and execute run.sh. You should see the code working correctly in one environment but not in the other. For instance, although the R script behaves as intended in R 4.2 it changes the gender of a study subject it does something unexpected (and issues a warning) in R 3.6.
To address that challenge, they turned to the R package renv, one of a small group of tools that help developers and researchers to manage their computational environments; other options include venv and virtualenv for Python, and conda, a language-agnostic tool. Most are command-line utilities, although renv is tightly integrated with the RStudio Desktop graphical programming environment. All can help researchers to ensure that their code is reproducible, reusable, documented and shareable.
C. Titus Brown, a bioinformatician at the University of California, Davis, has 187 conda environments on his laptop. Most are one-offs, used to test new tools or to illustrate a point during lectures. His day-to-day work mostly takes place in a development environment that includes a specific version of Python and other programming tools.
Some tasks, however, require a change of computational scenery. For instance, Brown writes blog posts in Markdown, which he renders into HTML, the standard markup language for web pages. But the code that performs that step doesnt work well with newer versions of a crucial software library, and older versions conflict with his development tools. To isolate the problem, Brown created a separate environment. I just fixed the version to something really old that still works, and I run [the rendering software] there, he says.
NatureTech
A conda environment is a computational sleight-of-hand, says Johannes Kster, a computer scientist at the University of Duisburg-Essen in Germany, who founded a bioinformatics-focused software repository called Bioconda. Basically, its just modifying your system path the place where your system searches for executable [applications]. You might have multiple versions of a tool installed, but when conda activates a particular environment, your computer can only see the one you want.
Computational environments offer several benefits, says Timbers. One is reproducibility the ability to analyse the same data with the same software on the same computing infrastructure to get the same results.
It can be very frustrating, tracing down the differences between outputs across different computers, says Ben Marwick, an archaeologist at the University of Washington in Seattle. Some research projects take years to complete, he notes. And although Marwick prefers the newest libraries, his colleagues dont always upgrade at the same pace. Renv ensures that he and his collaborators always run their project codes in the same way. The resulting environment-description file can be version-controlled and shared on GitHub. Collaborators can recreate the environment using the command renv::restore()Conda is a command-line tool that both creates environments and installs software into them. To create a new environment called my_env pinned to a specific version of Python, for instance, use conda create --name my_env python=3.9
Both R and conda allow users to install their own tools rather than having to ask system administrators to do it for them. You dont need root privileges, says Rob Patro, a computational biologist at the University of Maryland in College Park. This is a useful feature when working on shared computing resources.
Environment managers also make software installation easier. Scientific software is often released as source code, which might need to be compiled, configured and installed in a specific location. It might have a network of dependencies, written in multiple programming languages, that must be installed in a particular order. Sometimes, says bioinformatician Fredrik Boulund at the Karolinska Institute in Stockholm, the process can be beyond users skills. That completely changed when solutions like conda entered the scene, he says. Installing a complex set of dependencies is simply reduced to asking conda to create an environment according to an environment specification file.
Cut the tyranny of copy-and-paste with these coding tools
For the Galaxy project an open-source framework for reproducible data analysis those features were a key reason for choosing conda as the projects software installation manager. Bioinformatician Bjrn Grning, who runs the European Galaxy server at the University of Freiburg in Germany, says that the Galaxy community started searching for a cohesive tool-installation strategy in around 2015 because its existing, manual approach was unsustainable. Conda ticked all our requirement boxes, Grning says. It doesnt need root privileges; it is programming-language agnostic; and it uses human-readable package recipes that are easy to understand and maintain. Today, there are more than 9,000 bioinformatics tools available to Galaxy users through the Bioconda channel.
Perhaps the biggest benefit to environments, however, is isolation: environments enable researchers to explore new or updated tools while knowing that their code will still run.
Elana Fertig, a statistician at Johns Hopkins University in Baltimore, Maryland, describes herself as lax when it comes to environments: For me, everything goes in one environment. But larger environments are harder to use, because the environment manager has to resolve a larger network of dependencies to install new tools. (Conda is notorious for poor performance with large environments, but a drop-in resolver called mamba accelerates the process.) Instead, Fertig suggests that her students use one environment per project.
Indeed, most researchers contacted for this article recommend creating environments to accommodate specific workflows or projects and to do so early on. Start your project with a package-management solution in mind, says Joshua Shapiro, senior data scientist at the Childhood Cancer Data Lab for Alexs Lemonade Stand Foundation, based in Wynnewood, Pennsylvania. It has the potential to save a lot of headaches down the line.
Challenge to scientists: does your ten-year-old code still run?
Tommy Tang, director of computational biology at Immunitas Therapeutics, a biotechnology company in Waltham, Massachusetts, uses dedicated environments for different computational tasks processing data from RNA sequencing or working in Google Cloud, for instance.
Users of the Snakemake and Nextflow computational workflow managers can even direct those tools to execute each step in a separate conda environment, says Kster, who leads Snakemake development. Make them as fine-grained and as single-purpose as possible, he advises. Besides being easier to maintain, he explains, small environments are also more transparent. People who want to understand what the analysis actually did immediately see what software stack was used for which step.
Still, environments cant do everything. Tools written in languages such as C, Perl and Fortran can be hard to encapsulate into environments, and dependency differences can make environments difficult to port across operating systems. In that case, users can try software containers, such as those from Docker and Singularity.
Containers, which essentially package a tool with its underlying operating system, are larger and more complicated than environments, but are more portable. They are also easier to share, because although an environment can hold thousands of files, a container has only one. On high-performance systems in which jobs can be run in parallel across hundreds of computing cores, transferring many small files can affect performance.
Computational environments, says Timbers, are the forgotten child of reproducibility. Journals increasingly ask for code and data alongside manuscripts, but full reproducibility requires knowing the environment in which they were run. Its the elephant in the room, she says.
View post:
The sleight-of-hand trick that can simplify scientific computing - Nature.com
- Benchmark singularity: The timeless, award-winning classicism of To Pepe - Decanter - September 9th, 2025 [September 9th, 2025]
- SentinelOne Inside: How the Singularity Platform Is Redefining Cybersecurity with AI! - Smartkarma - September 9th, 2025 [September 9th, 2025]
- Non-singular Gravitational Collapse Avoids Singularity, Rebounds, and Deviates from Hawking Radiation - Quantum Zeitgeist - September 6th, 2025 [September 6th, 2025]
- The Singularity is here: How ProtYouth is Redefining Anti-Aging with Collagen - Daily Front Row - September 5th, 2025 [September 5th, 2025]
- Using data tools to time your Singularity Future Technology Ltd. exit - Weekly Loss Report & Verified Stock Trade Ideas - Newser - September 3rd, 2025 [September 3rd, 2025]
- How to read the order book for Singularity Future Technology Ltd. - Portfolio Return Report & Free Reliable Trade Execution Plans - Newser - September 1st, 2025 [September 1st, 2025]
- Researchers Resolve Schwarzschild Singularity Using Unimodular Time and Discover Theories Allowing Only One Mass Sign - Quantum Zeitgeist - September 1st, 2025 [September 1st, 2025]
- Is this a good reentry point in Singularity Future Technology Ltd. - July 2025 Final Week & Weekly Top Performers Watchlists - Newser - September 1st, 2025 [September 1st, 2025]
- Is Singularity Future Technology Ltd. forming a reversal pattern - July 2025 Big Picture & Accurate Intraday Trading Signals - Newser - September 1st, 2025 [September 1st, 2025]
- Using portfolio simulators with Singularity Future Technology Ltd. included - Quarterly Earnings Summary & Daily Technical Forecast Reports -... - September 1st, 2025 [September 1st, 2025]
- Chart based analysis of Singularity Future Technology Ltd. trends - Earnings Growth Summary & Expert Curated Trade Setup Alerts - Newser - September 1st, 2025 [September 1st, 2025]
- Order Book Volume Tilts Bullish on Singularity Future Technology Ltd. getLinesFromResByArray error: size == 0 - thegnnews.com - September 1st, 2025 [September 1st, 2025]
- 116 Pictures, Singularity, m25, Dandelion Studios x Juice, Laird and Good Company and Campaign Brief Asia host Legendary Party at Mad Stars - Campaign... - September 1st, 2025 [September 1st, 2025]
- Using fundamentals and technicals on Singularity Future Technology Ltd. - Market Weekly Review & Fast Exit/Entry Strategy Plans - Newser - September 1st, 2025 [September 1st, 2025]
- Chart based analysis of Singularity Future Technology Ltd. trends - Quarterly Trade Review & Accurate Technical Buy Alerts - Newser - August 29th, 2025 [August 29th, 2025]
- Tools to monitor Singularity Future Technology Ltd. recovery probability - 2025 Momentum Check & Expert Curated Trade Setup Alerts - Newser - August 29th, 2025 [August 29th, 2025]
- The Singularity Could Be Less Than 2,000 Days Away, Trend Shows - Popular Mechanics - August 29th, 2025 [August 29th, 2025]
- Real time pattern detection on Singularity Future Technology Ltd. stock - Earnings Summary Report & Free Weekly Chart Analysis and Trade Guides -... - August 29th, 2025 [August 29th, 2025]
- How to read the order book for Singularity Future Technology Ltd. - 2025 Geopolitical Influence & Fast Entry Momentum Trade Alerts - Newser - August 29th, 2025 [August 29th, 2025]
- Using data filters to optimize entry into Singularity Future Technology Ltd. - Analyst Downgrade & Reliable Price Action Trade Plans - Newser - August 29th, 2025 [August 29th, 2025]
- Using data filters to optimize entry into Singularity Future Technology Ltd. - 2025 Year in Review & Risk Controlled Swing Trade Alerts - Newser - August 29th, 2025 [August 29th, 2025]
- Using portfolio simulators with Singularity Future Technology Ltd. included - M&A Rumor & Fast Exit Strategy with Risk Control - Newser - August 29th, 2025 [August 29th, 2025]
- How to read the order book for Singularity Future Technology Ltd. - Quarterly Trade Summary & Weekly Sector Rotation Insights - Newser - August 29th, 2025 [August 29th, 2025]
- Sector ETF performance correlation with Singularity Future Technology Ltd. - Options Play & Free Community Supported Trade Ideas - Newser - August 27th, 2025 [August 27th, 2025]
- Signal strength of Singularity Future Technology Ltd. stock in tech scanners - Weekly Investment Report & Free Risk Controlled Daily Trade Plans -... - August 26th, 2025 [August 26th, 2025]
- Is this a good reentry point in Singularity Future Technology Ltd. - July 2025 Pullbacks & Weekly High Potential Stock Alerts - Newser - August 26th, 2025 [August 26th, 2025]
- Is this a good reentry point in Singularity Future Technology Ltd. - 2025 Top Gainers & Verified Short-Term Trading Plans - Newser - August 26th, 2025 [August 26th, 2025]
- For the Singularity to Truly Arrive, Wed Need a Machine That Eats the Sun - Popular Mechanics - August 26th, 2025 [August 26th, 2025]
- Will Singularity Future Technology Ltd. see short term momentum - Weekly Investment Summary & Fast Exit and Entry Trade Guides - Newser - August 24th, 2025 [August 24th, 2025]
- What indicators show strength in Singularity Future Technology Ltd. - 2025 Trading Recap & Capital Efficiency Focused Ideas - Newser - August 24th, 2025 [August 24th, 2025]
- Is it too late to sell Singularity Future Technology Ltd. - Analyst Upgrade & Smart Investment Allocation Insights - Newser - August 24th, 2025 [August 24th, 2025]
- Singularity an all-new Horror/Sci-Fi Anthology, Surges on Kickstarter - downthetubes.net - August 22nd, 2025 [August 22nd, 2025]
- Robots and Real Voices at Upcoming Singularity Summit - Media Update - August 22nd, 2025 [August 22nd, 2025]
- You're invited to Lounge with the Stars at our Legendary MadStars Party hosted by Dandelion Studios x Juice, 116 Pictures, Singularity, Laird and Good... - August 20th, 2025 [August 20th, 2025]
- SentinelOne's Singularity Platform Fuels Revenue: Will It Sustain? - Yahoo Finance - August 20th, 2025 [August 20th, 2025]
- Deadline to Submit Claims for the Singularity Future Technology Settlement is January 16, 2026 - TradingView - August 18th, 2025 [August 18th, 2025]
- SentinelOne's Singularity Platform Fuels Revenue: Will It Sustain? - ca.finance.yahoo.com - August 18th, 2025 [August 18th, 2025]
- Scrieving Scotland: Lets Talk About Culture and Politics After the Singularity - Bella Caledonia - August 18th, 2025 [August 18th, 2025]
- Ashes of the Singularity II Aims for a 2026 Release, Featuring Larger Battles and a New Campaign to Lead Humanity Against Hostile AI Takeover - MSN - August 12th, 2025 [August 12th, 2025]
- Ashes of the Singularity II announced, sequel to iconic DX12 benchmark game - VideoCardz.com - August 9th, 2025 [August 9th, 2025]
- The Western Powers Fall Into the Baudrillardian Singularity - Hungarian Conservative - August 9th, 2025 [August 9th, 2025]
- RTS sequel Ashes of the Singularity 2 promises to let you gleefully watch hundreds of thousands of units blow each other up in 2026 - Yahoo! Tech - August 9th, 2025 [August 9th, 2025]
- Ashes of the Singularity II Is Ready To Bring Humans To Battle 10 Years After The First - But Why Tho? - August 9th, 2025 [August 9th, 2025]
- Stardock CEO on AI in Gaming and Xbox Game Pass Impact Insights on Ashes of the Singularity II - Windows Central - August 7th, 2025 [August 7th, 2025]
- The humans are revolting in Ashes Of The Singularity 2, the latest planet-scale RTS from Oxide Games - Rock Paper Shotgun - August 7th, 2025 [August 7th, 2025]
- RTS sequel Ashes of the Singularity 2 promises to let you gleefully watch hundreds of thousands of units blow each other up in 2026 - PC Gamer - August 7th, 2025 [August 7th, 2025]
- Massive Scale RTS Game Ashes of the Singularity II Announced by Stardock and Oxide Games - TechPowerUp - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity 2 has been announced - OC3D - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity II Announced: Heres What We Know - VICE - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity 2 to bring back massive-scale RTS action in 2026 - Game Watcher - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity II - IGN Africa - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity II Announced For 2026 Release - Bleeding Cool News - August 7th, 2025 [August 7th, 2025]
- Massive scale RTS game Ashes of the Singularity II announced for 2026 - GamingOnLinux - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity II - IGN - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity II Doubles Down on Scale, Strategy and Story - CGMagazine - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity II Coming in 2026 - Steam Deck HQ - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity II announced for 2026 - KitGuru - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity 2 announced for PC - DBLTAP - August 7th, 2025 [August 7th, 2025]
- Massive RTS Ashes of the Singularity II Announced, Arrives in 2026 - Wccftech - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity II debuts in 2026 with massive sci-fi RTS battles - gamesbeat.com - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity II Latest Updates - Game Watcher - August 7th, 2025 [August 7th, 2025]
- RTS sequel Ashes of the Singularity 2 promises to let you gleefully watch hundreds of thousands of units blow each other up in 2026 - MSN - August 7th, 2025 [August 7th, 2025]
- Ashes of the Singularity II Announced: Human Faction Joins Epic RTS Warfare in 2026 - Zoom Bangla News - August 7th, 2025 [August 7th, 2025]
- SentinelOnes AI-Powered Singularity Platform Receives Highest Accreditation by Spanish Government To Protect and Secure IT Assets - Yahoo Finance - August 3rd, 2025 [August 3rd, 2025]
- SentinelOnes AI-Powered Singularity Platform Receives Highest Accreditation by Spanish Government To Protect and Secure IT Assets - The Globe and Mail - August 1st, 2025 [August 1st, 2025]
- Singularity in the future of Artificial Intelligence (AI): Utopian hopes or dystopian fears? - Business News Nigeria - August 1st, 2025 [August 1st, 2025]
- Aaron Vaccaro: Making the Aspirational Accessible at Singularity University - Grit Daily News - July 24th, 2025 [July 24th, 2025]
- Singularity Future Technology Ltd. Stock Analysis and Forecast - Exceptional growth trajectory - printweek.in - July 22nd, 2025 [July 22nd, 2025]
- The Geek Singularity: How AI is Redefining the Future of Geek Identity and Culture - Vocal - July 22nd, 2025 [July 22nd, 2025]
- Singularity Future Technology Ltd. Stock Analysis and Forecast - Free Trading Psychology Coaching - PrintWeekIndia - July 20th, 2025 [July 20th, 2025]
- Is Singularity Future Technology Ltd. a good long term investment - Exceptional market positioning - jammulinksnews.com - July 20th, 2025 [July 20th, 2025]
- What drives Singularity Future Technology Ltd. stock price - Unprecedented profits - jammulinksnews.com - July 20th, 2025 [July 20th, 2025]
- What analysts say about Singularity Future Technology Ltd. stock - Phenomenal trading returns - Autocar Professional - July 20th, 2025 [July 20th, 2025]
- Reaching AI 'Singularity' will hit billions of jobs - we need to prepare with urgency: Deb Hetherington - Yorkshire Post - July 18th, 2025 [July 18th, 2025]
- Exploiting hidden singularity on the surface of the Poincar sphere - Nature - July 4th, 2025 [July 4th, 2025]
- A Scientist Says Humans Will Reach the Singularity Within 20 Years - Popular Mechanics - July 2nd, 2025 [July 2nd, 2025]
- A Scientist Says Humans Will Reach the Singularity Within 20 Years - Yahoo - July 2nd, 2025 [July 2nd, 2025]
- Singularity Future Technology shareholders approve board election and equity plan - Investing.com India - July 2nd, 2025 [July 2nd, 2025]
- From Plancks Wall to AIs Singularity: Barriers Beyond Our Minds and Models - The Times of Israel - June 29th, 2025 [June 29th, 2025]
- 3.know: Singularity's Marketing Paradox, A Conversation With Anders Indset 06/28/2025 - MediaPost - June 28th, 2025 [June 28th, 2025]