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
- The IT Singularity Is Here: Announcing Forresters 2026 Technology Events - Forrester - June 24th, 2026 [June 24th, 2026]
- Bodycraft Raises Rs 120 Cr From Singularity AMC To Expand Across India - BW Disrupt - June 24th, 2026 [June 24th, 2026]
- Bodycraft Raises 120 Crore from Singularity AMC to Expand Clinic-and-Salon Network Across India - Indian Startup Times - June 24th, 2026 [June 24th, 2026]
- Demis Hassabis Thinks Were in the Foothills of the Singularity - Stanford Graduate School of Business - June 22nd, 2026 [June 22nd, 2026]
- Review: Echoes and Signals Singularity and Other Stories - The Progressive Subway - - June 22nd, 2026 [June 22nd, 2026]
- Will SentinelOne's (S) AI-native Purple Agent and Singularity Credits Reshape Its Platform Narrative? - Yahoo Finance - June 22nd, 2026 [June 22nd, 2026]
- Rethinking the Black Hole Singularity - NonStop Local KHQ - June 22nd, 2026 [June 22nd, 2026]
- A dying star might never collapse into a black hole a tiny Big Bang could ignite at its core and leave a gravastar with no singularity and no event... - June 22nd, 2026 [June 22nd, 2026]
- Sam Altman's AGI Shift: From Extinction Warning to Gentle Singularity - StartupHub.ai - June 16th, 2026 [June 16th, 2026]
- Huge share increase and reverse split on deck at Singularity Future Technology (NASDAQ: SGLY) - Stock Titan - June 16th, 2026 [June 16th, 2026]
- Kiran Mazumdar-Shaw's Immuneel Therapeutics raises Rs 100 crore from Singularity AMC, Rainmatter, others - The Economic Times - June 12th, 2026 [June 12th, 2026]
- Humanity may reach singularity within just 4 years, trend shows - MSN - June 12th, 2026 [June 12th, 2026]
- Immuneel Therapeutics secures Rs 100 crore funding from Singularity AMC and others - Indiatimes - June 12th, 2026 [June 12th, 2026]
- The SentinelOne stock correction is overdone as the Singularity platform drives steady growth - MSN - June 12th, 2026 [June 12th, 2026]
- The SentinelOne Stock Correction Is Overdone as the Singularity Platform Drives Steady Growth - Barchart.com - June 7th, 2026 [June 7th, 2026]
- Googles AI chief says were in the foothills of the singularity. Heres why that matters - Forbes Australia - June 5th, 2026 [June 5th, 2026]
- Does Carney believe the singularity is near? Canada PM admits he doesnt know enough to answer - Global News - June 5th, 2026 [June 5th, 2026]
- Navigating the AI singularity: a contrarian approach to a reconfigured world - Livewire Markets - June 5th, 2026 [June 5th, 2026]
- The SentinelOne Stock Correction Is Overdone as the Singularity Platform Drives Steady Growth - Yahoo Finance - June 5th, 2026 [June 5th, 2026]
- Deepmind's Hassabis sees humanity "in the foothills of the singularity" while LeCun says current AI isn't intelligent - the-decoder.com - May 27th, 2026 [May 27th, 2026]
- Newberry breaks ground on Harvest Singularity project aimed at transforming future of agriculture - WCJB - May 27th, 2026 [May 27th, 2026]
- Video The singularity is near: Google unveils next phase of AI - ABC News - Breaking News, Latest News and Videos - May 27th, 2026 [May 27th, 2026]
- The "Singularity" of Commercial Space Industry: Which of the 492 Concept Stocks Can Catch the Wave? - eu.36kr.com - May 27th, 2026 [May 27th, 2026]
- The singularity is near: Google unveils the next phase of AI - MSN - May 27th, 2026 [May 27th, 2026]
- Singularity Future Technology Disclosed Failure to Satisfy a Continued Listing Rule or Standard - TradingView - May 22nd, 2026 [May 22nd, 2026]
- Singularity Future Technology receives additional time from Nasdaq to meet bid price rule - Investing.com - May 22nd, 2026 [May 22nd, 2026]
- In the foothills of singularity: GoogleMind CEO says AI story has just begun - Firstpost - May 22nd, 2026 [May 22nd, 2026]
- Demis Hassabis said this might be the foothills of the singularity. What? - The Verge - May 20th, 2026 [May 20th, 2026]
- Humanity May Reach Singularity Within Just 4 Years, Trend Shows - Yahoo Tech - May 20th, 2026 [May 20th, 2026]
- International Seaways: The Ton-Mile Bullwhip And Zero-Debt Valuation Singularity - Seeking Alpha - May 20th, 2026 [May 20th, 2026]
- Abergavenny man claims he has outwitted the singularity - Abergavenny Chronicle - May 20th, 2026 [May 20th, 2026]
- A doctor spent 80 hours staying up late to modify code, while Codex finished it in 2 hours. The singularity of scientific research has arrived. -... - May 16th, 2026 [May 16th, 2026]
- Cell to Singularity - Evolution Never Ends (2018) - IMDb - May 7th, 2026 [May 7th, 2026]
- BlissClub Set To Raise 250 Cr From Singularity At 750 Cr Valuation, Accelerating Indias D2C Activewear Growth - D2c Insider Pulse - May 7th, 2026 [May 7th, 2026]
- The Coasean Singularity: Why AI Is Ending the Org Chart as We Know It - inc.com - May 5th, 2026 [May 5th, 2026]
- This singularity could arrive in just four years, and it all stems from a metric that almost no one outside the industry knew about - OkDiario - May 3rd, 2026 [May 3rd, 2026]
- AI: Were Already Stepping into the Singularity - European Scientist - May 3rd, 2026 [May 3rd, 2026]
- Bear McCreary announces "The Singularity: Ekleipsis" album and releases new single "Black Box" - Chaoszine - May 3rd, 2026 [May 3rd, 2026]
- China takes the lead, the US follows suit: The 'singularity moment' for humanoid robots has arrived! - Moomoo - May 3rd, 2026 [May 3rd, 2026]
- China takes the lead, the US follows suit: The 'singularity moment' for humanoid robots has arrived! - - May 3rd, 2026 [May 3rd, 2026]
- Akira Predicted the AI Singularity in 1988 - The Cold Magazine - May 3rd, 2026 [May 3rd, 2026]
- Prepping for the AI Singularity - The Harvard Crimson - April 27th, 2026 [April 27th, 2026]
- He Yi: The AI Singularity Has Arrived; Binance Aims to Serve 3 Billion People | 2026 Hong Kong Web3 Carnival - Binance - April 21st, 2026 [April 21st, 2026]
- The Media-Buying Singularity Is Almost Here: Upfront 2031-32 04/09/2026 - MediaPost - April 10th, 2026 [April 10th, 2026]
- Nvidia: Singularity In Agentic-As-A-Service Macroeconomy (NASDAQ:NVDA) - Seeking Alpha - April 8th, 2026 [April 8th, 2026]
- Ray Kurzweil and the 2045 Singularity: Will AI Make Us Immortal? - vocal.media - April 8th, 2026 [April 8th, 2026]
- "Memoirs Of The End," A New Novel Depicting Life After The A.I. Singularity - openPR.com - April 8th, 2026 [April 8th, 2026]
- 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]