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
- Samsung Galaxy Buds4 Pro - Heading Towards the Earwear Singularity - Newstalk ZB - March 26th, 2026 [March 26th, 2026]
- Elon Musk said that the singularity is not in the future, but now. - 36 Kr - March 13th, 2026 [March 13th, 2026]
- Singularity Is Closer Than We Think - Forbes - March 13th, 2026 [March 13th, 2026]
- Elon says Groks logo symbolizes AI singularity, a point where AI surpasses human intelligence and outcomes become unpredictable. He calls it very... - March 13th, 2026 [March 13th, 2026]
- Ashes of the Singularity II Gameplay Preview: Lasers, robots, tanks, oh my! - Gamereactor UK - March 13th, 2026 [March 13th, 2026]
- Steam game listing achieves knockoff singularity by aping Pokmon, Zelda, and even Overwatch designs with a shamelessness Palworld could only dream of... - March 13th, 2026 [March 13th, 2026]
- Singularity starts now? OpenAI Cofounder builds AI system that gets better on its own - India Today - March 13th, 2026 [March 13th, 2026]
- Elon Musk's latest interview: "Optimus Prime 3" is coming, AI "self-improvement" has already happened, and after the AI... - March 13th, 2026 [March 13th, 2026]
- Elon Musk's Latest Interview: 'Optimus 3' Is Coming, AI 'Self-Improvement' Is Already Happening, and 'Money Will No Longer Matter' After the AI... - March 13th, 2026 [March 13th, 2026]
- Stardock extends Ashes of the Singularity II demo period after Steam Next Fest success - OC3D - March 4th, 2026 [March 4th, 2026]
- Inside the Box: The Singularity Is Not NearIts Already Here - Jefferson Public Radio - March 2nd, 2026 [March 2nd, 2026]
- How Oxide Games is Making a 'Next-Gen' RTS with Ashes of the Singularity II - 80 Level - March 2nd, 2026 [March 2nd, 2026]
- Uneasy Money: Why the AI Singularity May Already Be Out of Our Hands - unchainedcrypto.com - March 2nd, 2026 [March 2nd, 2026]
- No, the human-robot singularity isnt here. But we must take action to govern AI | Samuel Woolley - The Guardian - February 14th, 2026 [February 14th, 2026]
- What Is A Singularity Drive? Star Trek's Alternative To Warp Drives, Explained - SlashFilm - February 14th, 2026 [February 14th, 2026]
- Humans Could Reach the Technological Singularity Within 19 Years, Scientist Warns How AI May Redefine Intelligence and Humanity Forever - vocal.media - February 14th, 2026 [February 14th, 2026]
- The Singularity Is Just Weird - Publishers Weekly - February 14th, 2026 [February 14th, 2026]
- The social singularity, when humans will no longer be able to handle the speed of AI evolution, will occur on July 18, 2034. - GIGAZINE - February 14th, 2026 [February 14th, 2026]
- Huachuang Securities: Large models lower the threshold for creation, and AI videos reach a 'singularity moment.' - - February 14th, 2026 [February 14th, 2026]
- The Operational Singularity and the Rise of Autonomous Medical Agents at WHX Dubai 2026 - geneonline.com - February 9th, 2026 [February 9th, 2026]
- Marketing Singularity: The Mad Men went to lab - ET BrandEquity - February 9th, 2026 [February 9th, 2026]
- Of The Singularity and Moltys - Trinidad Express Newspapers - February 9th, 2026 [February 9th, 2026]
- Moltbook: Hype or the Singularity? - The New Stack - February 7th, 2026 [February 7th, 2026]
- Beyond the Singularity: Why Musks Warning Misses the Real Story - The Times of Israel - February 7th, 2026 [February 7th, 2026]
- Neural Networks Become More Stable With New singularity Smoothing Technique - Quantum Zeitgeist - February 7th, 2026 [February 7th, 2026]
- Elon Musk warns a new social network where AI agents talk to one another is the beginning of 'the singularity' - MSN - February 7th, 2026 [February 7th, 2026]
- "We're in the singularity": New AI platform skips the humans entirely - Axios - February 2nd, 2026 [February 2nd, 2026]
- Elon Musk warns a new social network where AI agents talk to one another is the beginning of the singularity - Fortune - February 2nd, 2026 [February 2nd, 2026]
- The Sonic Singularity: Suno, Udio, and the Day Music Changed Forever - FinancialContent - February 2nd, 2026 [February 2nd, 2026]
- Is this the singularity or not? - Tech Brew - February 2nd, 2026 [February 2nd, 2026]
- A Scientist Says Humans Will Reach the Singularity Within 19 Years - Popular Mechanics - February 1st, 2026 [February 1st, 2026]
- Breaking: Singularity Reached? MoltAgents Build Own Social Network - The Tech Buzz - February 1st, 2026 [February 1st, 2026]
- Is This the Singularity? AI Bots Can't Stop Posting on a Social Platform Where Humans Aren't Allowed - inc.com - February 1st, 2026 [February 1st, 2026]
- Pinterest: Buying The Attribution Singularity At Value Prices (NYSE:PINS) - Seeking Alpha - February 1st, 2026 [February 1st, 2026]
- "We Have Entered the Singularity," Says Musk And the Signals Are Hard to Ignore - ucstrategies.com - February 1st, 2026 [February 1st, 2026]
- Elon Musk Warns Viral AI-Only Social Network Moltbook is the Singularity - iPhone in Canada - February 1st, 2026 [February 1st, 2026]
- Elon Musk reacts as AI enters uncharted territory with viral agent-only social network: Start of the singularity - Mint - February 1st, 2026 [February 1st, 2026]
- The Capital Singularity: Anthropics $20 Billion Gambit and the New Economics of AI - WebProNews - February 1st, 2026 [February 1st, 2026]
- A scientist says humans will reach the singularity within 19 years - MSN - February 1st, 2026 [February 1st, 2026]
- Elon Musk says singularity is here What to know about AI threats to humanity - The Star | Malaysia - February 1st, 2026 [February 1st, 2026]
- Why is $5,000 approaching? The 'singularity moment' for gold and the price surge driven by the integer effect - - January 26th, 2026 [January 26th, 2026]
- The Dawn of the Intelligence Revolution: Can Humanity Coexist with the Singularity - Vocal - January 26th, 2026 [January 26th, 2026]
- Alphabet's 'Ironwood' Singularity And The Inevitability Of The Zero-Marginal-Cost Compute Flywheel - Seeking Alpha - January 11th, 2026 [January 11th, 2026]
- Musk's 2026 Vision: We Are Already at the 'Technological Singularity,' AI and Robotics Are Unstoppable - - January 11th, 2026 [January 11th, 2026]
- 2026 Singularity? Muskian Comment Is Backed By Real Stuff - Forbes - January 9th, 2026 [January 9th, 2026]
- Elon Musk Predicts the Imminent Arrival of the AI Singularity - 36Kr - January 9th, 2026 [January 9th, 2026]
- SentinelOne achieves GovRamp authorization at the high impact level for its AI-powered Singularity Cybersecurity Platform - MarketScreener - January 9th, 2026 [January 9th, 2026]
- Will Singularity Future Technology Ltd. (4GS) stock hit analyst forecasts - July 2025 Drop Watch & AI Powered Buy and Sell Recommendations -... - January 9th, 2026 [January 9th, 2026]
- Tribute | The singularity of author Vinod Kumar Shukla - The Hindu - January 4th, 2026 [January 4th, 2026]
- Intellistake Technologies to buy Singularity Venture Hub - MSN - December 25th, 2025 [December 25th, 2025]
- Humanity May Reach Singularity Within Just 4 Years, Trend Shows - vocal.media - December 25th, 2025 [December 25th, 2025]
- Will Singularity Future Technology Ltd. stock reach all time highs in 2025 - Trendline Breakouts & High Yield Investment Tips - Bollywood Helpline - December 21st, 2025 [December 21st, 2025]
- Humanity May Reach Singularity Within Just 4 Years, Trend Shows - Popular Mechanics - December 21st, 2025 [December 21st, 2025]
- Ashes of the Singularity 2 - Official Gameplay Trailer - IGN India - December 16th, 2025 [December 16th, 2025]
- The Founders Dilemma In The Age of AI: Working Toward Singularity - Crunchbase News - December 16th, 2025 [December 16th, 2025]
- Intellistake Appoints Singularity Compute CEO Joe Honan to Its Advisory Board to Strengthen Vision Across Global AI Infrastructure - Yahoo Finance - November 30th, 2025 [November 30th, 2025]
- Is Singularity Future Technology Ltd. stock overvalued by current metrics - July 2025 Big Picture & Advanced Technical Analysis Signals - Fundao... - November 10th, 2025 [November 10th, 2025]
- The Incel Singularity II: Why Your AI Waifu Might Be Cheating on You (& How to Reclaim the Code) - Hackernoon - October 26th, 2025 [October 26th, 2025]
- Is Singularity Future Technology Ltd. (4GS) stock a good hedge against inflation - CPI Data & Target Return Focused Picks - nchmf.gov.vn - October 26th, 2025 [October 26th, 2025]
- A $2 billion "game of probabilities": Is the prediction market approaching its "singularity" moment? - Bitget - October 26th, 2025 [October 26th, 2025]
- A $2 Billion "Game of Probability": Is the Prediction Market Approaching Its "Singularity" Moment? - Bitget - October 24th, 2025 [October 24th, 2025]
- Intellistake Acquisition Target Singularity Venture Hub Partners with Project Mycelium on Sovereign AI Cloud Initiative - The Globe and Mail - October 23rd, 2025 [October 23rd, 2025]
- Intellistake Acquisition Target Singularity Venture Hub Partners with Project Mycelium on Sovereign AI Cloud Initiative - Cantech Letter - October 23rd, 2025 [October 23rd, 2025]
- Is Singularity Future Technology Ltd. (4GS) stock a good hedge against inflation - Trade Ideas & Long-Term Growth Plans - nchmf.gov.vn - October 21st, 2025 [October 21st, 2025]
- Institution Moves: Can Singularity Future Technology Ltd. stock sustain revenue growth - July 2025 Big Picture & AI Powered Market Trend Analysis... - October 19th, 2025 [October 19th, 2025]
- THE SINGULARITY | Friend for Sale: Disappearing Privacy and Surveillance Capitalism - The Hoya - October 15th, 2025 [October 15th, 2025]
- Deckanism: Singularity Island Drops Steam Next Fest Demo - Bleeding Cool News - October 13th, 2025 [October 13th, 2025]
- Comments - Brace Yourself for the TV 'Singularity' - Next in Media | Mike Shields - October 4th, 2025 [October 4th, 2025]
- Humanity May Achieve the Singularity Within the Next 3 Months, Scientists Suggest - Popular Mechanics - October 4th, 2025 [October 4th, 2025]
- Intellistake Technologies Corp. Signs Letter of Intent to Acquire Premier AI-Web3 Venture Accelerator Singularity Venture Hub - The Globe and Mail - October 2nd, 2025 [October 2nd, 2025]
- The singularity could arrive in just 5 years, experts warn - 3DVF - September 30th, 2025 [September 30th, 2025]
- The Economic Singularity And The Five As - Forbes - September 28th, 2025 [September 28th, 2025]
- Singularity and the Buzzard - Hussman Funds - September 28th, 2025 [September 28th, 2025]
- A New Brain-on-a-Chip May Usher in the Beginning of the Singularity - Popular Mechanics - September 28th, 2025 [September 28th, 2025]
- Book Review: The Singularity Is Nearer: When We Merge with AI - Cato Institute - September 23rd, 2025 [September 23rd, 2025]
- Everything You Need to Know About the Singularity South Africa Summit 2025 - Media Update - September 23rd, 2025 [September 23rd, 2025]
- J. D. Vance, Charlie Kirk, and the Politics-as-Talk-Show Singularity - The New Yorker - September 19th, 2025 [September 19th, 2025]
- Singularity South Africa Summit 2025: Everything you need to know - ZAWYA - September 19th, 2025 [September 19th, 2025]
- Singularity South Africa Summit 2025: Everything You Need to Know - undergroundpress.co.za - September 19th, 2025 [September 19th, 2025]
- Benchmark singularity: The timeless, award-winning classicism of To Pepe - Decanter - September 9th, 2025 [September 9th, 2025]